Commit 4f26bd71769f6fc0e1e0da17b22d43eaebedbed8
1 parent
bd41451d
优化级联语音对讲释放逻辑
Showing
3 changed files
with
32 additions
and
14 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| @@ -114,14 +114,15 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | @@ -114,14 +114,15 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 114 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId()); | 114 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(null, null, null, callIdHeader.getCallId()); |
| 115 | 115 | ||
| 116 | if (sendRtpItem != null){ | 116 | if (sendRtpItem != null){ |
| 117 | - logger.info("[收到bye] 来自平台{}, 停止通道:{}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId()); | 117 | + logger.info("[收到bye] 来自{},停止通道:{}, 类型: {}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getPlayType()); |
| 118 | + | ||
| 118 | String streamId = sendRtpItem.getStream(); | 119 | String streamId = sendRtpItem.getStream(); |
| 119 | Map<String, Object> param = new HashMap<>(); | 120 | Map<String, Object> param = new HashMap<>(); |
| 120 | param.put("vhost","__defaultVhost__"); | 121 | param.put("vhost","__defaultVhost__"); |
| 121 | param.put("app",sendRtpItem.getApp()); | 122 | param.put("app",sendRtpItem.getApp()); |
| 122 | param.put("stream",streamId); | 123 | param.put("stream",streamId); |
| 123 | param.put("ssrc",sendRtpItem.getSsrc()); | 124 | param.put("ssrc",sendRtpItem.getSsrc()); |
| 124 | - logger.info("[收到bye] 停止向上级推流:{}", streamId); | 125 | + logger.info("[收到bye] 停止推流:{}", streamId); |
| 125 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 126 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 126 | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), | 127 | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), |
| 127 | callIdHeader.getCallId(), null); | 128 | callIdHeader.getCallId(), null); |
| @@ -137,6 +138,14 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | @@ -137,6 +138,14 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 137 | }else { | 138 | }else { |
| 138 | logger.info("[上级平台停止观看] 未找到平台{}的信息,发送redis消息失败", sendRtpItem.getPlatformId()); | 139 | logger.info("[上级平台停止观看] 未找到平台{}的信息,发送redis消息失败", sendRtpItem.getPlatformId()); |
| 139 | } | 140 | } |
| 141 | + }else if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST) | ||
| 142 | + || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) { | ||
| 143 | + AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 144 | + if (audioBroadcastCatch != null) { | ||
| 145 | + // 来自上级平台的停止对讲 | ||
| 146 | + logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 147 | + audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 148 | + } | ||
| 140 | } | 149 | } |
| 141 | 150 | ||
| 142 | int totalReaderCount = zlmServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); | 151 | int totalReaderCount = zlmServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -516,6 +516,15 @@ public class ZLMHttpHookListener { | @@ -516,6 +516,15 @@ public class ZLMHttpHookListener { | ||
| 516 | sendRtpItem.getCallId(), sendRtpItem.getStream()); | 516 | sendRtpItem.getCallId(), sendRtpItem.getStream()); |
| 517 | } else { | 517 | } else { |
| 518 | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), param.getStream(), sendRtpItem.getCallId()); | 518 | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), param.getStream(), sendRtpItem.getCallId()); |
| 519 | + if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST) | ||
| 520 | + || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) { | ||
| 521 | + AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 522 | + if (audioBroadcastCatch != null) { | ||
| 523 | + // 来自上级平台的停止对讲 | ||
| 524 | + logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 525 | + audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); | ||
| 526 | + } | ||
| 527 | + } | ||
| 519 | } | 528 | } |
| 520 | } catch (SipException | InvalidArgumentException | ParseException | | 529 | } catch (SipException | InvalidArgumentException | ParseException | |
| 521 | SsrcTransactionNotFoundException e) { | 530 | SsrcTransactionNotFoundException e) { |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -1069,18 +1069,18 @@ public class PlayServiceImpl implements IPlayService { | @@ -1069,18 +1069,18 @@ public class PlayServiceImpl implements IPlayService { | ||
| 1069 | } | 1069 | } |
| 1070 | } | 1070 | } |
| 1071 | } | 1071 | } |
| 1072 | - SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); | ||
| 1073 | - if (sendRtpItem != null) { | ||
| 1074 | - MediaServerItem mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | ||
| 1075 | - Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream()); | ||
| 1076 | - if (streamReady) { | ||
| 1077 | - logger.warn("[语音对讲] 进行中: {}", channelId); | ||
| 1078 | - event.call("语音对讲进行中"); | ||
| 1079 | - return false; | ||
| 1080 | - } else { | ||
| 1081 | - stopTalk(device, channelId); | ||
| 1082 | - } | ||
| 1083 | - } | 1072 | +// SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); |
| 1073 | +// if (sendRtpItem != null) { | ||
| 1074 | +// MediaServerItem mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | ||
| 1075 | +// Boolean streamReady = zlmServerFactory.isStreamReady(mediaServer, sendRtpItem.getApp(), sendRtpItem.getStream()); | ||
| 1076 | +// if (streamReady) { | ||
| 1077 | +// logger.warn("[语音对讲] 进行中: {}", channelId); | ||
| 1078 | +// event.call("语音对讲进行中"); | ||
| 1079 | +// return false; | ||
| 1080 | +// } else { | ||
| 1081 | +// stopTalk(device, channelId); | ||
| 1082 | +// } | ||
| 1083 | +// } | ||
| 1084 | 1084 | ||
| 1085 | // 发送通知 | 1085 | // 发送通知 |
| 1086 | cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> { | 1086 | cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> { |