From 7609d7836c52a7619a51fa8b707502f027c2e1f0 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Sun, 3 Jul 2022 16:23:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=B9=E8=AE=B2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../event/request/impl/InviteRequestProcessor.java | 2 +- .../iot/vmp/media/zlm/ZLMHttpHookListener.java | 4 +--- .../iot/vmp/service/impl/PlayServiceImpl.java | 8 ++++++-- web_src/src/components/dialog/devicePlayer.vue | 12 ++++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index 7b7136f9..7a80de4e 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -830,7 +830,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements subscribeKey.put("app", app); subscribeKey.put("stream", stream); subscribeKey.put("regist", true); - subscribeKey.put("schema", "rtmp"); + subscribeKey.put("schema", "rtsp"); subscribeKey.put("mediaServerId", mediaServerItem.getId()); String finalSsrc = ssrc; // 流已经存在时直接推流 diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index 4ea9cf14..b47475ce 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -339,9 +339,7 @@ public class ZLMHttpHookListener { @PostMapping(value = "/on_stream_changed", produces = "application/json;charset=UTF-8") public ResponseEntity onStreamChanged(@RequestBody MediaItem item){ - if (logger.isDebugEnabled()) { - logger.debug("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); - } + logger.info("[ ZLM HOOK ]on_stream_changed API调用,参数:" + JSONObject.toJSONString(item)); String mediaServerId = item.getMediaServerId(); JSONObject json = (JSONObject) JSON.toJSON(item); ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, json); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index b9443753..1a8c5dec 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -689,6 +689,9 @@ public class PlayServiceImpl implements IPlayService { logger.warn("语音广播已经开启: {}", channelId); event.call("语音广播已经开启"); return; + }else { + audioBroadcastManager.del(deviceChannel.getDeviceId(),channelId); + redisCatchStorage.deleteSendRTPServer(device.getDeviceId(), channelId, sendRtpItem.getCallId(), sendRtpItem.getStreamId()); } } } @@ -710,7 +713,7 @@ public class PlayServiceImpl implements IPlayService { public void stopAudioBroadcast(String deviceId, String channelId){ AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(deviceId, channelId); if (audioBroadcastCatch != null) { - audioBroadcastManager.del(deviceId, audioBroadcastCatch.getChannelId()); + try { SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(deviceId, audioBroadcastCatch.getChannelId(), null, null); if (sendRtpItem != null) { @@ -722,11 +725,12 @@ public class PlayServiceImpl implements IPlayService { param.put("stream", sendRtpItem.getStreamId()); zlmresTfulUtils.stopSendRtp(mediaInfo, param); // 立刻结束设备的推流,等待自行结束太慢 -// zlmresTfulUtils.closeStreams(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStreamId()); + zlmresTfulUtils.closeStreams(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStreamId()); } if (audioBroadcastCatch.getStatus() == AudioBroadcastCatchStatus.Ok) { cmder.streamByeCmd(audioBroadcastCatch.getDialog(), audioBroadcastCatch.getRequest(), null); } + audioBroadcastManager.del(deviceId, channelId); } catch (SipException e) { throw new RuntimeException(e); diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index a33e8a4c..25628f2e 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -278,8 +278,9 @@
- +

+ 正在释放资源 点击开始对讲 等待接通中... 请说话 @@ -371,7 +372,7 @@ export default { showTimeText: "00:00:00", streamInfo: null, broadcastRtc: null, - broadcastStatus: -1, // -1 默认状态 0 等待接通 1 接通成功 + broadcastStatus: -1, // -2 正在释放资源 -1 默认状态 0 等待接通 1 接通成功 }; }, methods: { @@ -821,6 +822,9 @@ export default { }); }, getBroadcastStatus() { + if (this.broadcastStatus == -2) { + return "primary" + } if (this.broadcastStatus == -1) { return "primary" } @@ -835,6 +839,7 @@ export default { broadcastStatusClick() { if (this.broadcastStatus == -1) { // 默认状态, 开始 + this.broadcastStatus = 0 // 发起语音对讲 this.$axios({ method: 'get', @@ -924,7 +929,7 @@ export default { }); }, stopBroadcast(){ - this.broadcastRtc.close() + this.broadcastStatus = -2; this.broadcastRtc = null; this.$axios({ method: 'get', @@ -932,7 +937,6 @@ export default { }).then( (res)=> { if (res.data.code == 0) { // this.broadcastStatus = -1; - }else { this.$message({ showClose: true,