Commit 692f7167883a246067dfa0dc7f7f16d6ef309d9b
1 parent
5b3dc4d5
优化点播时RtpServer为正常关闭的问题
Showing
7 changed files
with
24 additions
and
10 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
| @@ -69,7 +69,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -69,7 +69,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 69 | * @param requestEvent RequestEvent事件 | 69 | * @param requestEvent RequestEvent事件 |
| 70 | */ | 70 | */ |
| 71 | @Override | 71 | @Override |
| 72 | - @Async | 72 | + @Async("taskExecutor") |
| 73 | public void processRequest(RequestEvent requestEvent) { | 73 | public void processRequest(RequestEvent requestEvent) { |
| 74 | String method = requestEvent.getRequest().getMethod(); | 74 | String method = requestEvent.getRequest().getMethod(); |
| 75 | if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) { | 75 | if ("NOTIFY".equalsIgnoreCase(requestEvent.getRequest().getMethod())) { |
| @@ -89,7 +89,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -89,7 +89,7 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 89 | * @param responseEvent responseEvent事件 | 89 | * @param responseEvent responseEvent事件 |
| 90 | */ | 90 | */ |
| 91 | @Override | 91 | @Override |
| 92 | - @Async | 92 | + @Async("taskExecutor") |
| 93 | public void processResponse(ResponseEvent responseEvent) { | 93 | public void processResponse(ResponseEvent responseEvent) { |
| 94 | Response response = responseEvent.getResponse(); | 94 | Response response = responseEvent.getResponse(); |
| 95 | int status = response.getStatusCode(); | 95 | int status = response.getStatusCode(); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
| @@ -102,7 +102,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -102,7 +102,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 102 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId, null, callIdHeader.getCallId()); | 102 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId, null, callIdHeader.getCallId()); |
| 103 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; | 103 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| 104 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 104 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 105 | - logger.info("收到ACK,开始向上级推流 rtp/{}", sendRtpItem.getStreamId()); | 105 | + logger.info("收到ACK,rtp/{}开始向上级推流, 目标 {}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); |
| 106 | Map<String, Object> param = new HashMap<>(); | 106 | Map<String, Object> param = new HashMap<>(); |
| 107 | param.put("vhost","__defaultVhost__"); | 107 | param.put("vhost","__defaultVhost__"); |
| 108 | param.put("app",sendRtpItem.getApp()); | 108 | param.put("app",sendRtpItem.getApp()); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -98,7 +98,18 @@ public class ZLMRTPServerFactory { | @@ -98,7 +98,18 @@ public class ZLMRTPServerFactory { | ||
| 98 | result = rtpInfo.getInteger("local_port"); | 98 | result = rtpInfo.getInteger("local_port"); |
| 99 | if (result == 0) { | 99 | if (result == 0) { |
| 100 | // 此时说明rtpServer已经创建但是流还没有推上来 | 100 | // 此时说明rtpServer已经创建但是流还没有推上来 |
| 101 | - | 101 | + // 此时重新打开rtpServer |
| 102 | + Map<String, Object> param = new HashMap<>(); | ||
| 103 | + param.put("stream_id", streamId); | ||
| 104 | + JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param); | ||
| 105 | + if (jsonObject != null ) { | ||
| 106 | + System.out.println(jsonObject); | ||
| 107 | + if (jsonObject.getInteger("code") == 0) { | ||
| 108 | + return createRTPServer(mediaServerItem, streamId, ssrc, port); | ||
| 109 | + }else { | ||
| 110 | + logger.warn("[开启rtpServer], 重启RtpServer错误"); | ||
| 111 | + } | ||
| 112 | + } | ||
| 102 | } | 113 | } |
| 103 | return result; | 114 | return result; |
| 104 | } | 115 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
| @@ -104,7 +104,7 @@ public class ZLMRunner implements CommandLineRunner { | @@ -104,7 +104,7 @@ public class ZLMRunner implements CommandLineRunner { | ||
| 104 | }, 60 * 1000 ); | 104 | }, 60 * 1000 ); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | - @Async | 107 | + @Async("taskExecutor") |
| 108 | public void connectZlmServer(MediaServerItem mediaServerItem){ | 108 | public void connectZlmServer(MediaServerItem mediaServerItem){ |
| 109 | String connectZlmServerTaskKey = "connect-zlm-" + mediaServerItem.getId(); | 109 | String connectZlmServerTaskKey = "connect-zlm-" + mediaServerItem.getId(); |
| 110 | ZLMServerConfig zlmServerConfigFirst = getMediaServerConfig(mediaServerItem); | 110 | ZLMServerConfig zlmServerConfigFirst = getMediaServerConfig(mediaServerItem); |
src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMStatusEventListener.java
| @@ -36,7 +36,7 @@ public class ZLMStatusEventListener { | @@ -36,7 +36,7 @@ public class ZLMStatusEventListener { | ||
| 36 | @Autowired | 36 | @Autowired |
| 37 | private IPlayService playService; | 37 | private IPlayService playService; |
| 38 | 38 | ||
| 39 | - @Async | 39 | + @Async("taskExecutor") |
| 40 | @EventListener | 40 | @EventListener |
| 41 | public void onApplicationEvent(ZLMOnlineEvent event) { | 41 | public void onApplicationEvent(ZLMOnlineEvent event) { |
| 42 | logger.info("[ZLM] 上线 ID:" + event.getMediaServerId()); | 42 | logger.info("[ZLM] 上线 ID:" + event.getMediaServerId()); |
| @@ -45,7 +45,7 @@ public class ZLMStatusEventListener { | @@ -45,7 +45,7 @@ public class ZLMStatusEventListener { | ||
| 45 | playService.zlmServerOnline(event.getMediaServerId()); | 45 | playService.zlmServerOnline(event.getMediaServerId()); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | - @Async | 48 | + @Async("taskExecutor") |
| 49 | @EventListener | 49 | @EventListener |
| 50 | public void onApplicationEvent(ZLMOfflineEvent event) { | 50 | public void onApplicationEvent(ZLMOfflineEvent event) { |
| 51 | 51 |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -253,7 +253,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -253,7 +253,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 253 | if (ssrcInfo == null) { | 253 | if (ssrcInfo == null) { |
| 254 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck(), false); | 254 | ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck(), false); |
| 255 | } | 255 | } |
| 256 | - logger.info("[点播开始] deviceId: {}, channelId: {}, SSRC: {}", device.getDeviceId(), channelId, ssrcInfo.getSsrc() ); | 256 | + logger.info("[点播开始] deviceId: {}, channelId: {},收流端口: {}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, ssrcInfo.getPort(), device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck() ); |
| 257 | // 超时处理 | 257 | // 超时处理 |
| 258 | String timeOutTaskKey = UUID.randomUUID().toString(); | 258 | String timeOutTaskKey = UUID.randomUUID().toString(); |
| 259 | SSRCInfo finalSsrcInfo = ssrcInfo; | 259 | SSRCInfo finalSsrcInfo = ssrcInfo; |
| @@ -262,12 +262,12 @@ public class PlayServiceImpl implements IPlayService { | @@ -262,12 +262,12 @@ public class PlayServiceImpl implements IPlayService { | ||
| 262 | 262 | ||
| 263 | SIPDialog dialog = streamSession.getDialogByStream(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); | 263 | SIPDialog dialog = streamSession.getDialogByStream(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); |
| 264 | if (dialog != null) { | 264 | if (dialog != null) { |
| 265 | - logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); | 265 | + logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc()); |
| 266 | timeoutCallback.run(1, "收流超时"); | 266 | timeoutCallback.run(1, "收流超时"); |
| 267 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 | 267 | // 点播超时回复BYE 同时释放ssrc以及此次点播的资源 |
| 268 | cmder.streamByeCmd(device.getDeviceId(), channelId, finalSsrcInfo.getStream(), null); | 268 | cmder.streamByeCmd(device.getDeviceId(), channelId, finalSsrcInfo.getStream(), null); |
| 269 | }else { | 269 | }else { |
| 270 | - logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {}", device.getDeviceId(), channelId); | 270 | + logger.info("[点播超时] 消息未响应 deviceId: {}, channelId: {},端口:{}, SSRC: {}", device.getDeviceId(), channelId, finalSsrcInfo.getPort(), finalSsrcInfo.getSsrc()); |
| 271 | timeoutCallback.run(0, "点播超时"); | 271 | timeoutCallback.run(0, "点播超时"); |
| 272 | mediaServerService.releaseSsrc(mediaServerItem.getId(), finalSsrcInfo.getSsrc()); | 272 | mediaServerService.releaseSsrc(mediaServerItem.getId(), finalSsrcInfo.getSsrc()); |
| 273 | mediaServerService.closeRTPServer(mediaServerItem, finalSsrcInfo.getStream()); | 273 | mediaServerService.closeRTPServer(mediaServerItem, finalSsrcInfo.getStream()); |
web_src/src/components/dialog/devicePlayer.vue
| @@ -394,6 +394,9 @@ export default { | @@ -394,6 +394,9 @@ export default { | ||
| 394 | console.log(this.videoUrl) | 394 | console.log(this.videoUrl) |
| 395 | }, | 395 | }, |
| 396 | openDialog: function (tab, deviceId, channelId, param) { | 396 | openDialog: function (tab, deviceId, channelId, param) { |
| 397 | + if (this.showVideoDialog) { | ||
| 398 | + return; | ||
| 399 | + } | ||
| 397 | this.tabActiveName = tab; | 400 | this.tabActiveName = tab; |
| 398 | this.channelId = channelId; | 401 | this.channelId = channelId; |
| 399 | this.deviceId = deviceId; | 402 | this.deviceId = deviceId; |