修复兼容zlm-pro转码时无人管看自动移除失败的BUG
parent
49101a37e0
commit
d70bfb53dd
|
@ -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);
|
||||
// 国标类型的流
|
||||
|
|
|
@ -92,7 +92,7 @@ public class MediaServiceImpl implements IMediaService {
|
|||
}
|
||||
if (!"broadcast".equalsIgnoreCase(app) && !ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix()) && !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())) {
|
||||
stream = stream + "_" + mediaInfo.getTranscodeSuffix();
|
||||
streamInfoResult.setStream(stream);
|
||||
// streamInfoResult.setStream(stream);
|
||||
}
|
||||
|
||||
streamInfoResult.setIp(addr);
|
||||
|
|
|
@ -37,6 +37,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
|
@ -147,6 +148,9 @@ public class PlayController {
|
|||
}
|
||||
streamInfo.channgeStreamIp(host);
|
||||
}
|
||||
if (!ObjectUtils.isEmpty(newMediaServerItem.getTranscodeSuffix()) && !"null".equalsIgnoreCase(newMediaServerItem.getTranscodeSuffix())) {
|
||||
streamInfo.setStream(streamInfo.getStream() + "_" + newMediaServerItem.getTranscodeSuffix());
|
||||
}
|
||||
wvpResult.setData(new StreamContent(streamInfo));
|
||||
}else {
|
||||
wvpResult.setCode(code);
|
||||
|
|
Loading…
Reference in New Issue