Commit cb5afce55eec2badda5090c27564e43f201ac9af

Authored by 648540858
1 parent 010e73b0

优化语音对讲定时任务的删除

src/main/java/com/genersoft/iot/vmp/gb28181/session/AudioBroadcastManager.java
@@ -25,6 +25,7 @@ public class AudioBroadcastManager { @@ -25,6 +25,7 @@ public class AudioBroadcastManager {
25 25
26 public void update(AudioBroadcastCatch audioBroadcastCatch) { 26 public void update(AudioBroadcastCatch audioBroadcastCatch) {
27 if (SipUtils.isFrontEnd(audioBroadcastCatch.getDeviceId())) { 27 if (SipUtils.isFrontEnd(audioBroadcastCatch.getDeviceId())) {
  28 + audioBroadcastCatch.setChannelId(audioBroadcastCatch.getDeviceId());
28 data.put(audioBroadcastCatch.getDeviceId(), audioBroadcastCatch); 29 data.put(audioBroadcastCatch.getDeviceId(), audioBroadcastCatch);
29 }else { 30 }else {
30 data.put(audioBroadcastCatch.getDeviceId() + audioBroadcastCatch.getChannelId(), audioBroadcastCatch); 31 data.put(audioBroadcastCatch.getDeviceId() + audioBroadcastCatch.getChannelId(), audioBroadcastCatch);
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -977,7 +977,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements @@ -977,7 +977,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
977 } 977 }
978 if (device != null) { 978 if (device != null) {
979 logger.info("收到设备" + requesterId + "的语音广播Invite请求"); 979 logger.info("收到设备" + requesterId + "的语音广播Invite请求");
980 - String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId() + broadcastCatch.getChannelId(); 980 + String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId();
  981 + if (!SipUtils.isFrontEnd(device.getDeviceId())) {
  982 + key += broadcastCatch.getChannelId();
  983 + }
981 dynamicTask.stop(key); 984 dynamicTask.stop(key);
982 try { 985 try {
983 responseAck(request, Response.TRYING); 986 responseAck(request, Response.TRYING);
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java
@@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; @@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
11 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 11 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
12 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; 12 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
13 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; 13 import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
  14 +import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
14 import com.genersoft.iot.vmp.service.IPlayService; 15 import com.genersoft.iot.vmp.service.IPlayService;
15 import gov.nist.javax.sip.message.SIPRequest; 16 import gov.nist.javax.sip.message.SIPRequest;
16 import org.dom4j.Element; 17 import org.dom4j.Element;
@@ -77,7 +78,10 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i @@ -77,7 +78,10 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i
77 audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.WaiteInvite); 78 audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.WaiteInvite);
78 audioBroadcastManager.update(audioBroadcastCatch); 79 audioBroadcastManager.update(audioBroadcastCatch);
79 // 等待invite消息, 超时则结束 80 // 等待invite消息, 超时则结束
80 - String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId() + channelId; 81 + String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId();
  82 + if (!SipUtils.isFrontEnd(device.getDeviceId())) {
  83 + key += audioBroadcastCatch.getChannelId();
  84 + }
81 dynamicTask.startDelay(key, ()->{ 85 dynamicTask.startDelay(key, ()->{
82 logger.info("[语音广播]等待invite消息超时:{}/{}", device.getDeviceId(), channelId); 86 logger.info("[语音广播]等待invite消息超时:{}/{}", device.getDeviceId(), channelId);
83 playService.stopAudioBroadcast(device.getDeviceId(), channelId); 87 playService.stopAudioBroadcast(device.getDeviceId(), channelId);