Commit 4f2cd4113462764ae2d056dfed9010c1c764321f

Authored by 朱俊杰
1 parent a9f88be8

修复上级平台点播过程中本平台生成的ssrc并没有在openRtp中使用导致会新生成ssrc和之前的冲突

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 476 }
477 477 });
478 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 481 if (code == InviteErrorCode.SUCCESS.getCode()){
490 482 hookEvent.run(code, msg, data);
491 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 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 503 } else if (gbStream != null) {
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -586,7 +586,7 @@ public class ZLMHttpHookListener {
586 586 resultHolder.put(key, uuid, result);
587 587  
588 588 if (!exist) {
589   - playService.play(mediaInfo, deviceId, channelId, (code, message, data) -> {
  589 + playService.play(mediaInfo, deviceId, channelId, null, (code, message, data) -> {
590 590 msg.setData(new HookResult(code, message));
591 591 resultHolder.invokeResult(msg);
592 592 });
... ...
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
... ... @@ -18,7 +18,7 @@ public interface IPlayService {
18 18  
19 19 void play(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId,
20 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 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 116  
117 117  
118 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 120 if (mediaServerItem == null) {
121 121 throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的zlm");
122 122 }
... ... @@ -162,7 +162,7 @@ public class PlayServiceImpl implements IPlayService {
162 162 if (mediaServerItem.isRtpEnable()) {
163 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 166 if (ssrcInfo == null) {
167 167 callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null);
168 168 inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
... ... @@ -1154,7 +1154,7 @@ public class PlayServiceImpl implements IPlayService {
1154 1154 }
1155 1155  
1156 1156 MediaServerItem newMediaServerItem = getNewMediaServerItem(device);
1157   - play(newMediaServerItem, deviceId, channelId, (code, msg, data)->{
  1157 + play(newMediaServerItem, deviceId, channelId, null, (code, msg, data)->{
1158 1158 if (code == InviteErrorCode.SUCCESS.getCode()) {
1159 1159 InviteInfo inviteInfoForPlay = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);
1160 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 116 // 录像查询以channelId作为deviceId查询
117 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 120 WVPResult<StreamContent> wvpResult = new WVPResult<>();
121 121 if (code == InviteErrorCode.SUCCESS.getCode()) {
122 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 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 126 if (errorCode == InviteErrorCode.SUCCESS.getCode()) {
127 127 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, serial, code);
128 128 if (inviteInfo != null && inviteInfo.getStreamInfo() != null) {
... ...