64850858
2021-07-16 89a9ab4534f10a224f70e546db838423e84a1965
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java
@@ -15,6 +15,9 @@
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.media.zlm.dto.IMediaServerItem;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -38,6 +41,8 @@
   private ZLMRTPServerFactory zlmrtpServerFactory;
   private IMediaServerService mediaServerService;
   /**
    * 处理BYE请求
    * @param evt
@@ -60,9 +65,10 @@
            param.put("stream",streamId);
            param.put("ssrc",sendRtpItem.getSsrc());
            logger.info("停止向上级推流:" + streamId);
            zlmrtpServerFactory.stopSendRtpStream(param);
            IMediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
            zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
            redisCatchStorage.deleteSendRTPServer(platformGbId, channelId);
            if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) {
            if (zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId) == 0) {
               logger.info(streamId + "无其它观看者,通知设备停止推流");
               cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId);
            }
@@ -112,4 +118,11 @@
      this.cmder = cmder;
   }
   public IMediaServerService getMediaServerService() {
      return mediaServerService;
   }
   public void setMediaServerService(IMediaServerService mediaServerService) {
      this.mediaServerService = mediaServerService;
   }
}