优化编码信息的展示

This commit is contained in:
648540858
2024-11-14 17:05:12 +08:00
parent 36f79d798b
commit 2060a2117c
5 changed files with 134 additions and 98 deletions

View File

@@ -33,6 +33,10 @@ public class MediaInfo {
private Integer width;
@Schema(description = "视频高度")
private Integer height;
@Schema(description = "FPS")
private Integer fps;
@Schema(description = "丢包率")
private Integer loss;
@Schema(description = "音频编码类型")
private String audioCodec;
@Schema(description = "音频通道数")
@@ -58,6 +62,7 @@ public class MediaInfo {
@Schema(description = "服务ID")
private String serverId;
public static MediaInfo getInstance(JSONObject jsonObject, MediaServer mediaServer, String serverId) {
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setMediaServer(mediaServer);
@@ -112,6 +117,13 @@ public class MediaInfo {
Integer sampleRate = trackJson.getInteger("sample_rate");
Integer height = trackJson.getInteger("height");
Integer width = trackJson.getInteger("height");
Integer fps = trackJson.getInteger("fps");
Integer loss = trackJson.getInteger("loss");
Integer frames = trackJson.getInteger("frames");
Long keyFrames = trackJson.getLongValue("key_frames");
Integer gop_interval_ms = trackJson.getInteger("gop_interval_ms");
Long gop_size = trackJson.getLongValue("gop_size");
Long duration = trackJson.getLongValue("duration");
if (channels != null) {
mediaInfo.setAudioChannels(channels);
@@ -125,6 +137,12 @@ public class MediaInfo {
if (width != null) {
mediaInfo.setWidth(width);
}
if (fps != null) {
mediaInfo.setFps(fps);
}
if (loss != null) {
mediaInfo.setLoss(loss);
}
if (duration > 0L) {
mediaInfo.setDuration(duration);
}

View File

@@ -118,15 +118,6 @@ public class ZLMHttpHookListener {
}
}
/**
* rtsp/rtmp流注册或注销时触发此事件此事件对回复不敏感。
*/
// @ResponseBody
// @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8")
// public HookResult onStreamChanged(@RequestBody JSONObject param) {
// System.out.println(11);
// return HookResult.SUCCESS();
// }
/**
* rtsp/rtmp流注册或注销时触发此事件此事件对回复不敏感。
*/