限制单个设备/通道 回放数

This commit is contained in:
zxb 2023-10-13 17:26:28 +08:00
parent f88ff28dc4
commit e3d28ae139

View File

@ -480,6 +480,17 @@ public class PlayServiceImpl implements IPlayService {
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备: " + deviceId + "不存在");
}
// 限制同时只能存在一个回放流, 如果已有回放流就关闭
InviteInfo oldInviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAYBACK, device.getDeviceId(), channelId);
try {
if(oldInviteInfo != null){
logger.info("已存在回放流, 关闭已有回放流 {}", oldInviteInfo);
inviteStreamService.removeInviteInfo(oldInviteInfo);
cmder.streamByeCmd(device, oldInviteInfo.getChannelId(),
oldInviteInfo.getStream(), null);
}
} catch (Exception ignore) {}
logger.info("[录像回放] deviceId: {}, channelId: {}, 开始时间: {}, 结束时间: {}, 收流端口:{}, 收流模式:{}, SSRC: {}, SSRC校验{}",
device.getDeviceId(), channelId, startTime, endTime, ssrcInfo.getPort(), device.getStreamMode(),
ssrcInfo.getSsrc(), device.isSsrcCheck());