|
|
@@ -170,15 +170,19 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|
|
callback.run(ErrorCode.ERROR100.getCode(), "保存失败", null);
|
|
|
return;
|
|
|
}
|
|
|
- HookSubscribeForStreamChange hookSubscribeForStreamChange = HookSubscribeFactory.on_stream_changed(param.getApp(), param.getStream(), true, "rtsp", mediaInfo.getId());
|
|
|
- hookSubscribe.addSubscribe(hookSubscribeForStreamChange, (mediaServerItem, response) -> {
|
|
|
- StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(
|
|
|
- mediaInfo, param.getApp(), param.getStream(), null, null);
|
|
|
- callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
|
|
|
- });
|
|
|
+
|
|
|
if (param.isEnable()) {
|
|
|
String talkKey = UUID.randomUUID().toString();
|
|
|
String delayTalkKey = UUID.randomUUID().toString();
|
|
|
+ HookSubscribeForStreamChange hookSubscribeForStreamChange = HookSubscribeFactory.on_stream_changed(param.getApp(), param.getStream(), true, "rtsp", mediaInfo.getId());
|
|
|
+ hookSubscribe.addSubscribe(hookSubscribeForStreamChange, (mediaServerItem, response) -> {
|
|
|
+ dynamicTask.stop(delayTalkKey);
|
|
|
+ hookSubscribe.removeSubscribe(hookSubscribeForStreamChange);
|
|
|
+ StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(
|
|
|
+ mediaInfo, param.getApp(), param.getStream(), null, null);
|
|
|
+ callback.run(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), streamInfo);
|
|
|
+ });
|
|
|
+
|
|
|
dynamicTask.startDelay(delayTalkKey, ()->{
|
|
|
StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStreamWithCheck(param.getApp(), param.getStream(), mediaInfo.getId(), false);
|
|
|
if (streamInfo != null) {
|
|
|
@@ -324,6 +328,9 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|
|
zlmresTfulUtils.closeStreams(mediaServerItem, param.getApp(), param.getStream());
|
|
|
}
|
|
|
if ("ffmpeg".equalsIgnoreCase(param.getType())){
|
|
|
+ if (param.getTimeoutMs() == 0) {
|
|
|
+ param.setTimeoutMs(15);
|
|
|
+ }
|
|
|
result = zlmresTfulUtils.addFFmpegSource(mediaServerItem, param.getSrcUrl().trim(), param.getDstUrl(),
|
|
|
param.getTimeoutMs() + "", param.isEnableAudio(), param.isEnableMp4(),
|
|
|
param.getFfmpegCmdKey());
|
|
|
@@ -379,6 +386,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|
|
gbStreamMapper.del(app, stream);
|
|
|
videoManagerStorager.deleteStreamProxy(app, stream);
|
|
|
redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream);
|
|
|
+ redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PUSH", app, stream);
|
|
|
JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyItem);
|
|
|
if (jsonObject != null && jsonObject.getInteger("code") == 0) {
|
|
|
logger.info("[移除代理]: 代理: {}/{}, 从zlm移除成功", app, stream);
|