648540858
2023-07-03 e4622d17a6cfe348fa39c644f798aac1f8b6069a
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -3,6 +3,8 @@
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
@@ -10,10 +12,11 @@
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
import com.genersoft.iot.vmp.service.IMediaServerService;
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
import com.genersoft.iot.vmp.service.bean.RequestPushStreamMsg;
import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
@@ -58,10 +61,13 @@
    private IRedisCatchStorage redisCatchStorage;
   @Autowired
    private UserSetting userSetting;
   @Autowired
   private IVideoManagerStorage storager;
   @Autowired
   private ZLMRTPServerFactory zlmrtpServerFactory;
   private ZLMServerFactory ZLMServerFactory;
   @Autowired
   private ZlmHttpHookSubscribe hookSubscribe;
@@ -134,15 +140,7 @@
            startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, jsonObject, param, callIdHeader);
         });
      }else {
         // 如果是非严格模式,需要关闭端口占用
         JSONObject startSendRtpStreamResult = null;
         if (sendRtpItem.getLocalPort() != 0) {
            if (zlmrtpServerFactory.releasePort(mediaInfo, sendRtpItem.getSsrc())) {
               startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
            }
         }else {
            startSendRtpStreamResult = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
         }
         JSONObject startSendRtpStreamResult = ZLMServerFactory.startSendRtpStream(mediaInfo, param);
         if (startSendRtpStreamResult != null) {
            startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader);
         }
@@ -155,6 +153,13 @@
      } else if (jsonObject.getInteger("code") == 0) {
         logger.info("调用ZLM推流接口, 结果: {}",  jsonObject);
         logger.info("RTP推流成功[ {}/{} ],{}->{}:{}, " ,param.get("app"), param.get("stream"), jsonObject.getString("local_port"), param.get("dst_url"), param.get("dst_port"));
         if (sendRtpItem.getPlayType() == InviteStreamType.PUSH) {
            MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStreamId(),
                  sendRtpItem.getChannelId(), parentPlatform.getServerGBId(), parentPlatform.getName(), userSetting.getServerId(),
                  sendRtpItem.getMediaServerId());
            messageForPushChannel.setPlatFormIndex(parentPlatform.getId());
            redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel);
         }
      } else {
         logger.error("RTP推流失败: {}, 参数:{}",jsonObject.getString("msg"), JSON.toJSONString(param));
         if (sendRtpItem.isOnlyAudio()) {