修复兼容zlm-pro转码时无人管看自动移除失败的BUG

This commit is contained in:
648540858
2024-05-20 11:37:07 +08:00
parent 49101a37e0
commit d70bfb53dd
3 changed files with 23 additions and 1 deletions

View File

@@ -351,6 +351,11 @@ public class ZLMHttpHookListener {
logger.info("[ZLM HOOK] 流变化未找到ZLM, {}", param.getMediaServerId());
return;
}
if (!ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix())
&& !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())
&& param.getStream().endsWith(mediaInfo.getTranscodeSuffix()) ) {
return;
}
if (subscribe != null) {
subscribe.response(mediaInfo, param);
}
@@ -563,6 +568,19 @@ public class ZLMHttpHookListener {
logger.info("[ZLM HOOK]流无人观看:{}->{}->{}/{}", param.getMediaServerId(), param.getSchema(),
param.getApp(), param.getStream());
MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
if (mediaInfo == null) {
JSONObject ret = new JSONObject();
ret.put("code", 0);
return ret;
}
if (!ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix())
&& !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())
&& param.getStream().endsWith(mediaInfo.getTranscodeSuffix()) ) {
param.setStream(param.getStream().substring(0, param.getStream().lastIndexOf(mediaInfo.getTranscodeSuffix()) -1 ));
}
JSONObject ret = new JSONObject();
ret.put("code", 0);
// 国标类型的流