Commit ccc0a99d6894844d83d751b924cfebe74da7826c

Authored by ‘sxh’
1 parent 652489b4

同步主线的代码,保持一致性

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -520,13 +520,13 @@ public class ZLMHttpHookListener { @@ -520,13 +520,13 @@ public class ZLMHttpHookListener {
520 // 拉流代理 520 // 拉流代理
521 StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream()); 521 StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
522 if (streamProxyItem != null) { 522 if (streamProxyItem != null) {
523 - if (streamProxyItem.isEnable_remove_none_reader()) { 523 + if (streamProxyItem.isEnableDisableNoneReader()) {
524 // 无人观看自动移除 524 // 无人观看自动移除
525 ret.put("close", true); 525 ret.put("close", true);
526 streamProxyService.del(param.getApp(), param.getStream()); 526 streamProxyService.del(param.getApp(), param.getStream());
527 - String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrc_url(); 527 + String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrcUrl();
528 logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url); 528 logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url);
529 - } else if (streamProxyItem.isEnable_disable_none_reader()) { 529 + } else if (streamProxyItem.isEnableDisableNoneReader()) {
530 // 无人观看停用 530 // 无人观看停用
531 ret.put("close", true); 531 ret.put("close", true);
532 // 修改数据 532 // 修改数据
@@ -625,7 +625,7 @@ public class ZLMHttpHookListener { @@ -625,7 +625,7 @@ public class ZLMHttpHookListener {
625 } else { 625 } else {
626 // 拉流代理 626 // 拉流代理
627 StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream()); 627 StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
628 - if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnable_disable_none_reader()) { 628 + if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnableDisableNoneReader()) {
629 streamProxyService.start(param.getApp(), param.getStream()); 629 streamProxyService.start(param.getApp(), param.getStream());
630 } 630 }
631 DeferredResult<HookResult> result = new DeferredResult<>(); 631 DeferredResult<HookResult> result = new DeferredResult<>();
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -593,11 +593,13 @@ public class DeviceServiceImpl implements IDeviceService { @@ -593,11 +593,13 @@ public class DeviceServiceImpl implements IDeviceService {
593 if(deviceInStore.isSwitchPrimarySubStream() != device.isSwitchPrimarySubStream()){ 593 if(deviceInStore.isSwitchPrimarySubStream() != device.isSwitchPrimarySubStream()){
594 //当修改设备的主子码流开关时,需要校验是否存在流,如果存在流则直接关闭 594 //当修改设备的主子码流开关时,需要校验是否存在流,如果存在流则直接关闭
595 List<SsrcTransaction> ssrcTransactionForAll = streamSession.getSsrcTransactionForAll(device.getDeviceId(), null, null, null); 595 List<SsrcTransaction> ssrcTransactionForAll = streamSession.getSsrcTransactionForAll(device.getDeviceId(), null, null, null);
596 - for (SsrcTransaction ssrcTransaction: ssrcTransactionForAll) {  
597 - try {  
598 - cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), ssrcTransaction.getStream(), null, null);  
599 - } catch (InvalidArgumentException | SsrcTransactionNotFoundException | ParseException | SipException e) {  
600 - throw new RuntimeException(e); 596 + if(ssrcTransactionForAll != null){
  597 + for (SsrcTransaction ssrcTransaction: ssrcTransactionForAll) {
  598 + try {
  599 + cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), ssrcTransaction.getStream(), null, null);
  600 + } catch (InvalidArgumentException | SsrcTransactionNotFoundException | ParseException | SipException e) {
  601 + throw new RuntimeException(e);
  602 + }
601 } 603 }
602 } 604 }
603 deviceChannelMapper.clearPlay(device.getDeviceId()); 605 deviceChannelMapper.clearPlay(device.getDeviceId());
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -428,27 +428,8 @@ public class PlayServiceImpl implements IPlayService { @@ -428,27 +428,8 @@ public class PlayServiceImpl implements IPlayService {
428 logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse); 428 logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse);
429 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { 429 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
430 logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); 430 logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
431 - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {  
432 - // ssrc 不可用  
433 - logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);  
434 - // 释放ssrc  
435 - ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());  
436 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());  
437 -  
438 - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),  
439 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);  
440 - if( device.isSwitchPrimarySubStream()){  
441 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId,isSubStream, null,  
442 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),  
443 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);  
444 - }else {  
445 - inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,  
446 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),  
447 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);  
448 - }  
449 -  
450 - return;  
451 - } 431 + // 释放ssrc
  432 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
452 // 单端口模式streamId也有变化,重新设置监听即可 433 // 单端口模式streamId也有变化,重新设置监听即可
453 if (!mediaServerItem.isRtpEnable()) { 434 if (!mediaServerItem.isRtpEnable()) {
454 // 添加订阅 435 // 添加订阅
@@ -812,17 +793,8 @@ public class PlayServiceImpl implements IPlayService { @@ -812,17 +793,8 @@ public class PlayServiceImpl implements IPlayService {
812 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { 793 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
813 logger.info("[录像回放] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); 794 logger.info("[录像回放] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
814 795
815 - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {  
816 - // ssrc 不可用  
817 - logger.info("[录像回放] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);  
818 - // 释放ssrc  
819 - dynamicTask.stop(playBackTimeOutTaskKey);  
820 - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());  
821 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());  
822 - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),  
823 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);  
824 - return;  
825 - } 796 + // 释放ssrc
  797 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
826 798
827 // 单端口模式streamId也有变化,需要重新设置监听 799 // 单端口模式streamId也有变化,需要重新设置监听
828 if (!mediaServerItem.isRtpEnable()) { 800 if (!mediaServerItem.isRtpEnable()) {
@@ -1016,15 +988,8 @@ public class PlayServiceImpl implements IPlayService { @@ -1016,15 +988,8 @@ public class PlayServiceImpl implements IPlayService {
1016 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { 988 if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
1017 logger.info("[录像下载] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse); 989 logger.info("[录像下载] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
1018 990
1019 - if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {  
1020 - // ssrc 不可用  
1021 - // 释放ssrc  
1022 - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());  
1023 - streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());  
1024 - callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),  
1025 - InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);  
1026 - return;  
1027 - } 991 + // 释放ssrc
  992 + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
1028 993
1029 // 单端口模式streamId也有变化,需要重新设置监听 994 // 单端口模式streamId也有变化,需要重新设置监听
1030 if (!mediaServerItem.isRtpEnable()) { 995 if (!mediaServerItem.isRtpEnable()) {