Commit db6f722d20cf897a4a507b44c2f8af7081fca929
1 parent
66210ec5
优化国标级联语音喊话TCP主动模式
Showing
1 changed file
with
17 additions
and
2 deletions
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -538,7 +538,22 @@ public class PlayServiceImpl implements IPlayService { | @@ -538,7 +538,22 @@ public class PlayServiceImpl implements IPlayService { | ||
| 538 | } | 538 | } |
| 539 | logger.info("[TCP主动连接对方] deviceId: {}, channelId: {}, 连接对方的地址:{}:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, sdp.getConnection().getAddress(), port, device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck()); | 539 | logger.info("[TCP主动连接对方] deviceId: {}, channelId: {}, 连接对方的地址:{}:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, sdp.getConnection().getAddress(), port, device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck()); |
| 540 | JSONObject jsonObject = zlmresTfulUtils.connectRtpServer(mediaServerItem, sdp.getConnection().getAddress(), port, ssrcInfo.getStream()); | 540 | JSONObject jsonObject = zlmresTfulUtils.connectRtpServer(mediaServerItem, sdp.getConnection().getAddress(), port, ssrcInfo.getStream()); |
| 541 | - logger.info("[TCP主动连接对方] 结果: {}", jsonObject); | 541 | + logger.info("[TCP主动连接对方] 结果: {}" , jsonObject); |
| 542 | + if (jsonObject.getInteger("code") != 0) { | ||
| 543 | + // 主动连接失败,结束流程, 清理数据 | ||
| 544 | + dynamicTask.stop(timeOutTaskKey); | ||
| 545 | + mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); | ||
| 546 | + // 释放ssrc | ||
| 547 | + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); | ||
| 548 | + | ||
| 549 | + streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); | ||
| 550 | + | ||
| 551 | + callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | ||
| 552 | + InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | ||
| 553 | + inviteStreamService.call(InviteSessionType.BROADCAST, device.getDeviceId(), channelId, null, | ||
| 554 | + InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | ||
| 555 | + InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | ||
| 556 | + } | ||
| 542 | } catch (SdpException e) { | 557 | } catch (SdpException e) { |
| 543 | logger.error("[TCP主动连接对方] deviceId: {}, channelId: {}, 解析200OK的SDP信息失败", device.getDeviceId(), channelId, e); | 558 | logger.error("[TCP主动连接对方] deviceId: {}, channelId: {}, 解析200OK的SDP信息失败", device.getDeviceId(), channelId, e); |
| 544 | dynamicTask.stop(timeOutTaskKey); | 559 | dynamicTask.stop(timeOutTaskKey); |
| @@ -550,7 +565,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -550,7 +565,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 550 | 565 | ||
| 551 | callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | 566 | callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), |
| 552 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | 567 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); |
| 553 | - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, | 568 | + inviteStreamService.call(InviteSessionType.BROADCAST, device.getDeviceId(), channelId, null, |
| 554 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | 569 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), |
| 555 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | 570 | InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); |
| 556 | } | 571 | } |