同步主线的代码,保持一致性
This commit is contained in:
parent
ed6aaa25b9
commit
5d6b8c1804
@ -520,13 +520,13 @@ public class ZLMHttpHookListener {
|
||||
// 拉流代理
|
||||
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
||||
if (streamProxyItem != null) {
|
||||
if (streamProxyItem.isEnable_remove_none_reader()) {
|
||||
if (streamProxyItem.isEnableDisableNoneReader()) {
|
||||
// 无人观看自动移除
|
||||
ret.put("close", true);
|
||||
streamProxyService.del(param.getApp(), param.getStream());
|
||||
String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrc_url();
|
||||
String url = streamProxyItem.getUrl() != null ? streamProxyItem.getUrl() : streamProxyItem.getSrcUrl();
|
||||
logger.info("[{}/{}]<-[{}] 拉流代理无人观看已经移除", param.getApp(), param.getStream(), url);
|
||||
} else if (streamProxyItem.isEnable_disable_none_reader()) {
|
||||
} else if (streamProxyItem.isEnableDisableNoneReader()) {
|
||||
// 无人观看停用
|
||||
ret.put("close", true);
|
||||
// 修改数据
|
||||
@ -625,7 +625,7 @@ public class ZLMHttpHookListener {
|
||||
} else {
|
||||
// 拉流代理
|
||||
StreamProxyItem streamProxyByAppAndStream = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
||||
if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnable_disable_none_reader()) {
|
||||
if (streamProxyByAppAndStream != null && streamProxyByAppAndStream.isEnableDisableNoneReader()) {
|
||||
streamProxyService.start(param.getApp(), param.getStream());
|
||||
}
|
||||
DeferredResult<HookResult> result = new DeferredResult<>();
|
||||
|
@ -593,11 +593,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
if(deviceInStore.isSwitchPrimarySubStream() != device.isSwitchPrimarySubStream()){
|
||||
//当修改设备的主子码流开关时,需要校验是否存在流,如果存在流则直接关闭
|
||||
List<SsrcTransaction> ssrcTransactionForAll = streamSession.getSsrcTransactionForAll(device.getDeviceId(), null, null, null);
|
||||
for (SsrcTransaction ssrcTransaction: ssrcTransactionForAll) {
|
||||
try {
|
||||
cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), ssrcTransaction.getStream(), null, null);
|
||||
} catch (InvalidArgumentException | SsrcTransactionNotFoundException | ParseException | SipException e) {
|
||||
throw new RuntimeException(e);
|
||||
if(ssrcTransactionForAll != null){
|
||||
for (SsrcTransaction ssrcTransaction: ssrcTransactionForAll) {
|
||||
try {
|
||||
cmder.streamByeCmd(device, ssrcTransaction.getChannelId(), ssrcTransaction.getStream(), null, null);
|
||||
} catch (InvalidArgumentException | SsrcTransactionNotFoundException | ParseException | SipException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
deviceChannelMapper.clearPlay(device.getDeviceId());
|
||||
|
@ -428,27 +428,8 @@ public class PlayServiceImpl implements IPlayService {
|
||||
logger.info("[点播消息] 收到invite 200, 发现下级自定义了ssrc: {}", ssrcInResponse);
|
||||
if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
|
||||
logger.info("[点播消息] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
|
||||
if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
|
||||
// ssrc 不可用
|
||||
logger.info("[点播消息] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
|
||||
// 释放ssrc
|
||||
ssrcFactory.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
||||
|
||||
callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
|
||||
if( device.isSwitchPrimarySubStream()){
|
||||
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId,isSubStream, null,
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
|
||||
}else {
|
||||
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// 释放ssrc
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
// 单端口模式streamId也有变化,重新设置监听即可
|
||||
if (!mediaServerItem.isRtpEnable()) {
|
||||
// 添加订阅
|
||||
@ -812,17 +793,8 @@ public class PlayServiceImpl implements IPlayService {
|
||||
if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
|
||||
logger.info("[录像回放] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
|
||||
|
||||
if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
|
||||
// ssrc 不可用
|
||||
logger.info("[录像回放] SSRC修正时发现ssrc不可使用 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
|
||||
// 释放ssrc
|
||||
dynamicTask.stop(playBackTimeOutTaskKey);
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
||||
callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
|
||||
return;
|
||||
}
|
||||
// 释放ssrc
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
|
||||
// 单端口模式streamId也有变化,需要重新设置监听
|
||||
if (!mediaServerItem.isRtpEnable()) {
|
||||
@ -1016,15 +988,8 @@ public class PlayServiceImpl implements IPlayService {
|
||||
if (!mediaServerItem.isRtpEnable() || device.isSsrcCheck()) {
|
||||
logger.info("[录像下载] SSRC修正 {}->{}", ssrcInfo.getSsrc(), ssrcInResponse);
|
||||
|
||||
if (!ssrcFactory.checkSsrc(mediaServerItem.getId(),ssrcInResponse)) {
|
||||
// ssrc 不可用
|
||||
// 释放ssrc
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
||||
callback.run(InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getCode(),
|
||||
InviteErrorCode.ERROR_FOR_SSRC_UNAVAILABLE.getMsg(), null);
|
||||
return;
|
||||
}
|
||||
// 释放ssrc
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
|
||||
// 单端口模式streamId也有变化,需要重新设置监听
|
||||
if (!mediaServerItem.isRtpEnable()) {
|
||||
|
Loading…
Reference in New Issue
Block a user