From 5364db2982fb3dfff22659d535344d3df82e838a Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期日, 03 七月 2022 22:27:04 +0800
Subject: [PATCH] 优化对讲逻辑

---
 src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

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 595f628..1a8c5de 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
@@ -142,7 +142,7 @@
         result.onCompletion(()->{
             // 鐐规挱缁撴潫鏃惰皟鐢ㄦ埅鍥炬帴鍙�
             // TODO 搴旇鍦ㄤ笂娴佹椂璋冪敤鏇村ソ锛岀粨鏉熶篃鍙兘鏄敊璇粨鏉�
-            String path =  "static/static/snap/";
+            String path =  "snap";
             String fileName =  deviceId + "_" + channelId + ".jpg";
             ResponseEntity responseEntity =  (ResponseEntity)result.getResult();
             if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) {
@@ -689,6 +689,9 @@
                     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 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 @@
                     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);

--
Gitblit v1.8.0