Commit 381c3bdc2079ece5147cf4cee004e9071edadf7a

Authored by 648540858
1 parent 2bc28422

修复国标点播下级平台,ssrc更新的时单端口错误更新rtpserver的问题

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
... ... @@ -349,7 +349,17 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
349 349 }else {
350 350 ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12);
351 351 }
352   - logger.info("[上级点播] 用户:{}, 通道:{}, 地址:{}:{}, ssrc:{}", username, channelId, addressStr, port, ssrc);
  352 + String streamTypeStr = null;
  353 + if (mediaTransmissionTCP) {
  354 + if (tcpActive) {
  355 + streamTypeStr = "TCP-ACTIVE";
  356 + }else {
  357 + streamTypeStr = "TCP-PASSIVE";
  358 + }
  359 + }else {
  360 + streamTypeStr = "UDP";
  361 + }
  362 + logger.info("[上级点播] 平台:{}, 通道:{}, 收流地址:{}:{},收流方式:{}, ssrc:{}", username, channelId, addressStr, port, streamTypeStr, ssrc);
353 363 SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
354 364 device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp());
355 365  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -326,9 +326,9 @@ public class PlayServiceImpl implements IPlayService {
326 326 logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse);
327 327 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
328 328 logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
329   -
330 329 if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
331 330 // ssrc 不可用
  331 + logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
332 332 // 释放ssrc
333 333 ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
334 334 streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
... ... @@ -337,8 +337,7 @@ public class PlayServiceImpl implements IPlayService {
337 337 errorEvent.response(event);
338 338 return;
339 339 }
340   -
341   - // 单端口模式streamId也有变化,需要重新设置监听
  340 + // 单端口模式streamId也有变化,重新设置监听即可
342 341 if (!mediaServerItem.isRtpEnable()) {
343 342 // 添加订阅
344 343 HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
... ... @@ -351,8 +350,11 @@ public class PlayServiceImpl implements IPlayService {
351 350 onPublishHandlerForPlay(mediaServerItemInUse, response, device.getDeviceId(), channelId);
352 351 hookEvent.response(mediaServerItemInUse, response);
353 352 });
  353 + return;
354 354 }
355 355  
  356 +
  357 + // 更新ssrc
356 358 Boolean result = mediaServerService.updateRtpServerSSRC(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse);
357 359 if (!result) {
358 360 try {
... ... @@ -372,32 +374,8 @@ public class PlayServiceImpl implements IPlayService {
372 374 event.statusCode = 500;
373 375 errorEvent.response(event);
374 376 }
375   -// // 关闭rtp server
376   -// mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream(), result->{
377   -// if (result) {
378   -// // 重新开启ssrc server
379   -// mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false, ssrcInfo.getPort(), true, device.getStreamModeForParam());
380   -// }else {
381   -// try {
382   -// logger.warn("[停止点播] {}/{}", device.getDeviceId(), channelId);
383   -// cmder.streamByeCmd(device, channelId, ssrcInfo.getStream(), null, null);
384   -// } catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
385   -// logger.error("[命令发送失败] 停止点播, 发送BYE: {}", e.getMessage());
386   -// throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
387   -// }
388   -//
389   -// dynamicTask.stop(timeOutTaskKey);
390   -// // 释放ssrc
391   -// mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
392   -//
393   -// streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
394   -// event.msg = "下级自定义了ssrc,重新设置收流信息失败";
395   -// event.statusCode = 500;
396   -// errorEvent.response(event);
397   -// }
398   -// });
399   -
400   -
  377 + }else {
  378 + logger.info("[点播消息] 收到invite 200, 下级自定义了ssrc, 但是当前模式无需修正");
401 379 }
402 380 }
403 381 }, (event) -> {
... ...