From d21322a93258206eb910d7ac3a70a4812fc48cbc Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 03 三月 2022 18:23:52 +0800 Subject: [PATCH] 优化国标级联录像预览 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java | 34 +++++++++++++++++++++++----------- 1 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java index 64812b6..deda783 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java @@ -2,6 +2,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.gb28181.bean.Device; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; @@ -28,10 +29,8 @@ import java.util.HashMap; import java.util.Map; -/** - * @description: BYE璇锋眰澶勭悊鍣� - * @author: lawrencehj - * @date: 2021骞�3鏈�9鏃� +/** + * SIP鍛戒护绫诲瀷锛� BYE璇锋眰 */ @Component public class ByeRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { @@ -89,21 +88,34 @@ MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); - if (zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId) == 0) { + int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); + if (totalReaderCount == 0) { logger.info(streamId + "鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦"); - cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId); + cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId); + }else if (totalReaderCount == -1){ + logger.warn(streamId + " 鏌ユ壘鍏跺畠瑙傜湅鑰呭け璐�"); } } // 鍙兘鏄澶囦富鍔ㄥ仠姝� Device device = storager.queryVideoDeviceByChannelId(platformGbId); - if (device != null) { + if (device != null) { StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(device.getDeviceId(), channelId); - if (streamInfo != null) { - redisCatchStorage.stopPlay(streamInfo); + if (sendRtpItem != null) { + if (sendRtpItem.isPlay()) { + if (streamInfo != null) { + redisCatchStorage.stopPlay(streamInfo); + } + }else { + if (streamInfo != null) { + redisCatchStorage.stopPlayback(streamInfo); + } + } + + storager.stopPlay(device.getDeviceId(), channelId); + mediaServerService.closeRTPServer(device.getDeviceId(), channelId, streamInfo.getStream()); } - storager.stopPlay(device.getDeviceId(), channelId); - mediaServerService.closeRTPServer(device, channelId); } + } } catch (SipException e) { e.printStackTrace(); -- Gitblit v1.8.0