Commit e1c8183adf076901275b2e4e9ec93b97aaacc957
1 parent
da4ac962
调整语音对讲超时任务位置
Showing
2 changed files
with
12 additions
and
32 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.common.VideoManagerConstants; | |
| 4 | 3 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | 4 | import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatch; |
| 6 | 5 | import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatchStatus; |
| 7 | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 8 | 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 9 | 8 | import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; |
| 10 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | |
| 11 | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | |
| 15 | 12 | import com.genersoft.iot.vmp.service.IPlayService; |
| 16 | 13 | import gov.nist.javax.sip.message.SIPRequest; |
| 17 | 14 | import org.dom4j.Element; |
| ... | ... | @@ -77,15 +74,6 @@ public class BroadcastResponseMessageHandler extends SIPRequestProcessorParent i |
| 77 | 74 | AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(device.getDeviceId(), channelId); |
| 78 | 75 | audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.WaiteInvite); |
| 79 | 76 | audioBroadcastManager.update(audioBroadcastCatch); |
| 80 | - // 等待invite消息, 超时则结束 | |
| 81 | - String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId(); | |
| 82 | - if (!SipUtils.isFrontEnd(device.getDeviceId())) { | |
| 83 | - key += audioBroadcastCatch.getChannelId(); | |
| 84 | - } | |
| 85 | - dynamicTask.startDelay(key, ()->{ | |
| 86 | - logger.info("[语音广播]等待invite消息超时:{}/{}", device.getDeviceId(), channelId); | |
| 87 | - playService.stopAudioBroadcast(device.getDeviceId(), channelId); | |
| 88 | - }, 2000); | |
| 89 | 77 | }else { |
| 90 | 78 | playService.stopAudioBroadcast(device.getDeviceId(), channelId); |
| 91 | 79 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -3,10 +3,7 @@ package com.genersoft.iot.vmp.service.impl; |
| 3 | 3 | import com.alibaba.fastjson2.JSONArray; |
| 4 | 4 | import com.alibaba.fastjson2.JSONObject; |
| 5 | 5 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 6 | -import com.genersoft.iot.vmp.common.InviteInfo; | |
| 7 | -import com.genersoft.iot.vmp.common.InviteSessionStatus; | |
| 8 | -import com.genersoft.iot.vmp.common.InviteSessionType; | |
| 9 | -import com.genersoft.iot.vmp.common.StreamInfo; | |
| 6 | +import com.genersoft.iot.vmp.common.*; | |
| 10 | 7 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 11 | 8 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 12 | 9 | import com.genersoft.iot.vmp.conf.UserSetting; |
| ... | ... | @@ -18,19 +15,13 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 18 | 15 | import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; |
| 19 | 16 | import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; |
| 20 | 17 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 21 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | |
| 22 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | |
| 23 | 18 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 24 | -import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | |
| 19 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | |
| 25 | 20 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 21 | +import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; | |
| 26 | 22 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 27 | 23 | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| 28 | 24 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| 29 | -import com.genersoft.iot.vmp.media.zlm.dto.*; | |
| 30 | -import com.genersoft.iot.vmp.media.zlm.*; | |
| 31 | -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 32 | -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 33 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | |
| 34 | 25 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; |
| 35 | 26 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRecordMp4; |
| 36 | 27 | import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; |
| ... | ... | @@ -40,15 +31,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam; |
| 40 | 31 | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| 41 | 32 | import com.genersoft.iot.vmp.service.*; |
| 42 | 33 | import com.genersoft.iot.vmp.service.bean.*; |
| 43 | -import com.genersoft.iot.vmp.service.bean.ErrorCallback; | |
| 44 | -import com.genersoft.iot.vmp.service.bean.InviteErrorCode; | |
| 45 | -import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg; | |
| 46 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | |
| 47 | 34 | import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; |
| 48 | -import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; | |
| 49 | -import com.genersoft.iot.vmp.service.bean.ErrorCallback; | |
| 50 | -import com.genersoft.iot.vmp.service.bean.InviteErrorCode; | |
| 51 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | |
| 52 | 35 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 53 | 36 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 54 | 37 | import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; |
| ... | ... | @@ -1179,6 +1162,15 @@ public class PlayServiceImpl implements IPlayService { |
| 1179 | 1162 | // 发送成功 |
| 1180 | 1163 | AudioBroadcastCatch audioBroadcastCatch = new AudioBroadcastCatch(device.getDeviceId(), channelId, mediaServerItem, app, stream, event, AudioBroadcastCatchStatus.Ready, isFromPlatform); |
| 1181 | 1164 | audioBroadcastManager.update(audioBroadcastCatch); |
| 1165 | + // 等待invite消息, 超时则结束 | |
| 1166 | + String key = VideoManagerConstants.BROADCAST_WAITE_INVITE + device.getDeviceId(); | |
| 1167 | + if (!SipUtils.isFrontEnd(device.getDeviceId())) { | |
| 1168 | + key += audioBroadcastCatch.getChannelId(); | |
| 1169 | + } | |
| 1170 | + dynamicTask.startDelay(key, ()->{ | |
| 1171 | + logger.info("[语音广播]等待invite消息超时:{}/{}", device.getDeviceId(), channelId); | |
| 1172 | + stopAudioBroadcast(device.getDeviceId(), channelId); | |
| 1173 | + }, 2000); | |
| 1182 | 1174 | }, eventResultForError -> { |
| 1183 | 1175 | // 发送失败 |
| 1184 | 1176 | logger.error("语音广播发送失败: {}:{}", channelId, eventResultForError.msg); | ... | ... |