Commit ba884fa9efc763be6abc631ebf84362483a9ce1c
1 parent
a01086fe
默认关闭ssrc check
Showing
2 changed files
with
5 additions
and
34 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -165,7 +165,7 @@ public class Device { | @@ -165,7 +165,7 @@ public class Device { | ||
| 165 | * 是否开启ssrc校验,默认关闭,开启可以防止串流 | 165 | * 是否开启ssrc校验,默认关闭,开启可以防止串流 |
| 166 | */ | 166 | */ |
| 167 | @Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流") | 167 | @Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流") |
| 168 | - private boolean ssrcCheck = true; | 168 | + private boolean ssrcCheck = false; |
| 169 | 169 | ||
| 170 | /** | 170 | /** |
| 171 | * 地理坐标系, 目前支持 WGS84,GCJ02 | 171 | * 地理坐标系, 目前支持 WGS84,GCJ02 |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -818,39 +818,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -818,39 +818,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 818 | // 查询到ssrc不一致且开启了ssrc校验则需要针对处理 | 818 | // 查询到ssrc不一致且开启了ssrc校验则需要针对处理 |
| 819 | if (ssrcInfo.getSsrc().equals(ssrcInResponse)) { | 819 | if (ssrcInfo.getSsrc().equals(ssrcInResponse)) { |
| 820 | if (device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) { | 820 | if (device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) { |
| 821 | - String substring = contentString.substring(0, contentString.indexOf("y=")); | ||
| 822 | - try { | ||
| 823 | - SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); | ||
| 824 | - int port = -1; | ||
| 825 | - Vector mediaDescriptions = sdp.getMediaDescriptions(true); | ||
| 826 | - for (Object description : mediaDescriptions) { | ||
| 827 | - MediaDescription mediaDescription = (MediaDescription) description; | ||
| 828 | - Media media = mediaDescription.getMedia(); | ||
| 829 | - | ||
| 830 | - Vector mediaFormats = media.getMediaFormats(false); | ||
| 831 | - if (mediaFormats.contains("96")) { | ||
| 832 | - port = media.getMediaPort(); | ||
| 833 | - break; | ||
| 834 | - } | ||
| 835 | - } | ||
| 836 | - logger.info("[录像下载-TCP主动连接对方] deviceId: {}, channelId: {}, 连接对方的地址:{}:{}, 收流模式:{}, SSRC: {}, SSRC校验:{}", device.getDeviceId(), channelId, sdp.getConnection().getAddress(), port, device.getStreamMode(), ssrcInfo.getSsrc(), device.isSsrcCheck()); | ||
| 837 | - JSONObject jsonObject = zlmresTfulUtils.connectRtpServer(mediaServerItem, sdp.getConnection().getAddress(), port, ssrcInfo.getStream()); | ||
| 838 | - logger.info("[录像下载-TCP主动连接对方] 结果: {}", jsonObject); | ||
| 839 | - } catch (SdpException e) { | ||
| 840 | - logger.error("[录像下载-TCP主动连接对方] deviceId: {}, channelId: {}, 解析200OK的SDP信息失败", device.getDeviceId(), channelId, e); | ||
| 841 | - dynamicTask.stop(downLoadTimeOutTaskKey); | ||
| 842 | - mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); | ||
| 843 | - // 释放ssrc | ||
| 844 | - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); | ||
| 845 | - | ||
| 846 | - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); | ||
| 847 | - | ||
| 848 | - callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | ||
| 849 | - InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | ||
| 850 | - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, | ||
| 851 | - InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(), | ||
| 852 | - InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null); | ||
| 853 | - } | 821 | + tcpActiveHandler(device, channelId, contentString, mediaServerItem, downLoadTimeOutTaskKey, ssrcInfo, callback); |
| 854 | } | 822 | } |
| 855 | return; | 823 | return; |
| 856 | } | 824 | } |
| @@ -902,6 +870,9 @@ public class PlayServiceImpl implements IPlayService { | @@ -902,6 +870,9 @@ public class PlayServiceImpl implements IPlayService { | ||
| 902 | ssrcInfo.setSsrc(ssrcInResponse); | 870 | ssrcInfo.setSsrc(ssrcInResponse); |
| 903 | inviteInfo.setSsrcInfo(ssrcInfo); | 871 | inviteInfo.setSsrcInfo(ssrcInfo); |
| 904 | inviteInfo.setStream(ssrcInfo.getStream()); | 872 | inviteInfo.setStream(ssrcInfo.getStream()); |
| 873 | + if (device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) { | ||
| 874 | + tcpActiveHandler(device, channelId, contentString, mediaServerItem, downLoadTimeOutTaskKey, ssrcInfo, callback); | ||
| 875 | + } | ||
| 905 | } | 876 | } |
| 906 | }else { | 877 | }else { |
| 907 | logger.info("[录像下载] 收到invite 200, 下级自定义了ssrc, 但是当前模式无需修正"); | 878 | logger.info("[录像下载] 收到invite 200, 下级自定义了ssrc, 但是当前模式无需修正"); |