From e3d28ae139c6d698349080fc10b790d3292a12ce Mon Sep 17 00:00:00 2001 From: zxb <919411476@qq.com> Date: Fri, 13 Oct 2023 17:26:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=8D=95=E4=B8=AA=E8=AE=BE?= =?UTF-8?q?=E5=A4=87/=E9=80=9A=E9=81=93=20=E5=9B=9E=E6=94=BE=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/service/impl/PlayServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index bb58f183..07b9d9b6 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -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());