Commit 4f2cd4113462764ae2d056dfed9010c1c764321f
1 parent
a9f88be8
修复上级平台点播过程中本平台生成的ssrc并没有在openRtp中使用导致会新生成ssrc和之前的冲突
Showing
6 changed files
with
19 additions
and
17 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| @@ -476,16 +476,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -476,16 +476,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 476 | } | 476 | } |
| 477 | }); | 477 | }); |
| 478 | }else { | 478 | }else { |
| 479 | - sendRtpItem.setPlayType(InviteStreamType.PLAY); | ||
| 480 | - String streamId = null; | ||
| 481 | - if (mediaServerItem.isRtpEnable()) { | ||
| 482 | - streamId = String.format("%s_%s", device.getDeviceId(), channelId); | ||
| 483 | - }else { | ||
| 484 | - streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase(); | ||
| 485 | - } | ||
| 486 | - sendRtpItem.setStreamId(streamId); | ||
| 487 | - redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 488 | - playService.play(mediaServerItem, device.getDeviceId(), channelId, ((code, msg, data) -> { | 479 | + |
| 480 | + SSRCInfo ssrcInfo = playService.play(mediaServerItem, device.getDeviceId(), channelId, ssrc, ((code, msg, data) -> { | ||
| 489 | if (code == InviteErrorCode.SUCCESS.getCode()){ | 481 | if (code == InviteErrorCode.SUCCESS.getCode()){ |
| 490 | hookEvent.run(code, msg, data); | 482 | hookEvent.run(code, msg, data); |
| 491 | }else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()){ | 483 | }else if (code == InviteErrorCode.ERROR_FOR_SIGNALLING_TIMEOUT.getCode() || code == InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode()){ |
| @@ -496,6 +488,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -496,6 +488,16 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 496 | errorEvent.run(code, msg, data); | 488 | errorEvent.run(code, msg, data); |
| 497 | } | 489 | } |
| 498 | })); | 490 | })); |
| 491 | + sendRtpItem.setPlayType(InviteStreamType.PLAY); | ||
| 492 | + String streamId = null; | ||
| 493 | + if (mediaServerItem.isRtpEnable()) { | ||
| 494 | + streamId = String.format("%s_%s", device.getDeviceId(), channelId); | ||
| 495 | + }else { | ||
| 496 | + streamId = String.format("%08x", Integer.parseInt(ssrcInfo.getSsrc())).toUpperCase(); | ||
| 497 | + } | ||
| 498 | + sendRtpItem.setStreamId(streamId); | ||
| 499 | + sendRtpItem.setSsrc(ssrcInfo.getSsrc()); | ||
| 500 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 499 | 501 | ||
| 500 | } | 502 | } |
| 501 | } else if (gbStream != null) { | 503 | } else if (gbStream != null) { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -586,7 +586,7 @@ public class ZLMHttpHookListener { | @@ -586,7 +586,7 @@ public class ZLMHttpHookListener { | ||
| 586 | resultHolder.put(key, uuid, result); | 586 | resultHolder.put(key, uuid, result); |
| 587 | 587 | ||
| 588 | if (!exist) { | 588 | if (!exist) { |
| 589 | - playService.play(mediaInfo, deviceId, channelId, (code, message, data) -> { | 589 | + playService.play(mediaInfo, deviceId, channelId, null, (code, message, data) -> { |
| 590 | msg.setData(new HookResult(code, message)); | 590 | msg.setData(new HookResult(code, message)); |
| 591 | resultHolder.invokeResult(msg); | 591 | resultHolder.invokeResult(msg); |
| 592 | }); | 592 | }); |
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
| @@ -18,7 +18,7 @@ public interface IPlayService { | @@ -18,7 +18,7 @@ public interface IPlayService { | ||
| 18 | 18 | ||
| 19 | void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, | 19 | void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, |
| 20 | ErrorCallback<Object> callback); | 20 | ErrorCallback<Object> callback); |
| 21 | - SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, ErrorCallback<Object> callback); | 21 | + SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<Object> callback); |
| 22 | 22 | ||
| 23 | MediaServerItem getNewMediaServerItem(Device device); | 23 | MediaServerItem getNewMediaServerItem(Device device); |
| 24 | 24 |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -116,7 +116,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -116,7 +116,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | @Override | 118 | @Override |
| 119 | - public SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, ErrorCallback<Object> callback) { | 119 | + public SSRCInfo play(MediaServerItem mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<Object> callback) { |
| 120 | if (mediaServerItem == null) { | 120 | if (mediaServerItem == null) { |
| 121 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的zlm"); | 121 | throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的zlm"); |
| 122 | } | 122 | } |
| @@ -162,7 +162,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -162,7 +162,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 162 | if (mediaServerItem.isRtpEnable()) { | 162 | if (mediaServerItem.isRtpEnable()) { |
| 163 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); | 163 | streamId = String.format("%s_%s", device.getDeviceId(), channelId); |
| 164 | } | 164 | } |
| 165 | - SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, device.isSsrcCheck(), false, 0, false, device.getStreamModeForParam()); | 165 | + SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(), false, 0, false, device.getStreamModeForParam()); |
| 166 | if (ssrcInfo == null) { | 166 | if (ssrcInfo == null) { |
| 167 | callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null); | 167 | callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null); |
| 168 | inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, | 168 | inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null, |
| @@ -1154,7 +1154,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -1154,7 +1154,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 1154 | } | 1154 | } |
| 1155 | 1155 | ||
| 1156 | MediaServerItem newMediaServerItem = getNewMediaServerItem(device); | 1156 | MediaServerItem newMediaServerItem = getNewMediaServerItem(device); |
| 1157 | - play(newMediaServerItem, deviceId, channelId, (code, msg, data)->{ | 1157 | + play(newMediaServerItem, deviceId, channelId, null, (code, msg, data)->{ |
| 1158 | if (code == InviteErrorCode.SUCCESS.getCode()) { | 1158 | if (code == InviteErrorCode.SUCCESS.getCode()) { |
| 1159 | InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); | 1159 | InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); |
| 1160 | if (inviteInfoForPlay != null && inviteInfoForPlay.getStreamInfo() != null) { | 1160 | if (inviteInfoForPlay != null && inviteInfoForPlay.getStreamInfo() != null) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -116,7 +116,7 @@ public class PlayController { | @@ -116,7 +116,7 @@ public class PlayController { | ||
| 116 | // 录像查询以channelId作为deviceId查询 | 116 | // 录像查询以channelId作为deviceId查询 |
| 117 | resultHolder.put(key, uuid, result); | 117 | resultHolder.put(key, uuid, result); |
| 118 | 118 | ||
| 119 | - playService.play(newMediaServerItem, deviceId, channelId, (code, msg, data) -> { | 119 | + playService.play(newMediaServerItem, deviceId, channelId, null, (code, msg, data) -> { |
| 120 | WVPResult<StreamContent> wvpResult = new WVPResult<>(); | 120 | WVPResult<StreamContent> wvpResult = new WVPResult<>(); |
| 121 | if (code == InviteErrorCode.SUCCESS.getCode()) { | 121 | if (code == InviteErrorCode.SUCCESS.getCode()) { |
| 122 | wvpResult.setCode(ErrorCode.SUCCESS.getCode()); | 122 | wvpResult.setCode(ErrorCode.SUCCESS.getCode()); |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
| @@ -122,7 +122,7 @@ public class ApiStreamController { | @@ -122,7 +122,7 @@ public class ApiStreamController { | ||
| 122 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); | 122 | MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device); |
| 123 | 123 | ||
| 124 | 124 | ||
| 125 | - playService.play(newMediaServerItem, serial, code, (errorCode, msg, data) -> { | 125 | + playService.play(newMediaServerItem, serial, code, null, (errorCode, msg, data) -> { |
| 126 | if (errorCode == InviteErrorCode.SUCCESS.getCode()) { | 126 | if (errorCode == InviteErrorCode.SUCCESS.getCode()) { |
| 127 | InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, serial, code); | 127 | InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, serial, code); |
| 128 | if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { | 128 | if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { |