Commit ccc0a99d6894844d83d751b924cfebe74da7826c
1 parent
652489b4
同步主线的代码,保持一致性
Showing
3 changed files
with
17 additions
and
50 deletions
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -520,13 +520,13 @@ public class ZLMHttpHookListener { |
| 520 | 520 | // 拉流代理 |
| 521 | 521 | StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream()); |
| 522 | 522 | if (streamProxyItem != null) { |
| 523 | - if (streamProxyItem.isEnable_remove_none_reader()) { | |
| 523 | + if (streamProxyItem.isEnableDisableNoneReader()) { | |
| 524 | 524 | // 无人观看自动移除 |
| 525 | 525 | ret.put("close", true); |
| 526 | 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 | 528 | logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url); |
| 529 | - } else if (streamProxyItem.isEnable_disable_none_reader()) { | |
| 529 | + } else if (streamProxyItem.isEnableDisableNoneReader()) { | |
| 530 | 530 | // 无人观看停用 |
| 531 | 531 | ret.put("close", true); |
| 532 | 532 | // 修改数据 |
| ... | ... | @@ -625,7 +625,7 @@ public class ZLMHttpHookListener { |
| 625 | 625 | } else { |
| 626 | 626 | // 拉流代理 |
| 627 | 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 | 629 | streamProxyService.start(param.getApp(), param.getStream()); |
| 630 | 630 | } |
| 631 | 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 | 593 | if(deviceInStore.isSwitchPrimarySubStream() != device.isSwitchPrimarySubStream()){ |
| 594 | 594 | //当修改设备的主子码流开关时,需要校验是否存在流,如果存在流则直接关闭 |
| 595 | 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 | 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 | 428 | logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse); |
| 429 | 429 | if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { |
| 430 | 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 | 433 | // 单端口模式streamId也有变化,重新设置监听即可 |
| 453 | 434 | if (!mediaServerItem.isRtpEnable()) { |
| 454 | 435 | // 添加订阅 |
| ... | ... | @@ -812,17 +793,8 @@ public class PlayServiceImpl implements IPlayService { |
| 812 | 793 | if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { |
| 813 | 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 | 799 | // 单端口模式streamId也有变化,需要重新设置监听 |
| 828 | 800 | if (!mediaServerItem.isRtpEnable()) { |
| ... | ... | @@ -1016,15 +988,8 @@ public class PlayServiceImpl implements IPlayService { |
| 1016 | 988 | if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) { |
| 1017 | 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 | 994 | // 单端口模式streamId也有变化,需要重新设置监听 |
| 1030 | 995 | if (!mediaServerItem.isRtpEnable()) { | ... | ... |