Commit 4a34097b682f6dc0327f410e8454276fe7cfefd5

Authored by 648540858
1 parent 988dc36f

录像下载不使用固定地址

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
... ... @@ -166,6 +166,7 @@ public class SIPRequestHeaderPlarformProvider {
166 166  
167 167 public Request createMessageRequest(ParentPlatform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
168 168 CallIdHeader callIdHeader = SipFactory.getInstance().createHeaderFactory().createCallIdHeader(sendRtpItem.getCallId());
  169 + callIdHeader.setCallId(sendRtpItem.getCallId());
169 170 return createMessageRequest(parentPlatform, content, sendRtpItem.getToTag(), SipUtils.getNewViaTag(), sendRtpItem.getFromTag(), callIdHeader);
170 171 }
171 172  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
... ... @@ -111,9 +111,20 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
111 111 logger.warn("[收到ACK]:未找到通道({})的推流信息", channelId);
112 112 return;
113 113 }
  114 + // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤
  115 + if (sendRtpItem.isTcpActive()) {
  116 + logger.info("收到ACK,rtp/{} TCP主动方式后续处理", sendRtpItem.getStreamId());
  117 + return;
  118 + }
114 119 String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
115 120 MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
116   - logger.info("收到ACK,rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
  121 + logger.info("收到ACK,rtp/{}开始向上级推流, 目标={}:{},SSRC={}, 协议:{}",
  122 + sendRtpItem.getStreamId(),
  123 + sendRtpItem.getIp(),
  124 + sendRtpItem.getPort(),
  125 + sendRtpItem.getSsrc(),
  126 + sendRtpItem.isTcp()?(sendRtpItem.isTcpActive()?"TCP主动":"TCP被动"):"UDP"
  127 + );
117 128 Map<String, Object> param = new HashMap<>(12);
118 129 param.put("vhost","__defaultVhost__");
119 130 param.put("app",sendRtpItem.getApp());
... ... @@ -130,10 +141,6 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
130 141 // 开启rtcp保活
131 142 param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0");
132 143 }
133   - // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤
134   - if (sendRtpItem.isTcpActive()) {
135   - return;
136   - }
137 144 if (mediaInfo == null) {
138 145 RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance(
139 146 sendRtpItem.getMediaServerId(), sendRtpItem.getApp(), sendRtpItem.getStreamId(),
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -12,7 +12,6 @@ import com.genersoft.iot.vmp.conf.exception.ServiceException;
12 12 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
13 13 import com.genersoft.iot.vmp.gb28181.bean.*;
14 14 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
15   -import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
16 15 import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
17 16 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
18 17 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
... ... @@ -39,7 +38,6 @@ import gov.nist.javax.sip.message.SIPResponse;
39 38 import org.slf4j.Logger;
40 39 import org.slf4j.LoggerFactory;
41 40 import org.springframework.beans.factory.annotation.Autowired;
42   -import org.springframework.data.redis.core.RedisTemplate;
43 41 import org.springframework.stereotype.Service;
44 42 import org.springframework.util.ObjectUtils;
45 43  
... ... @@ -688,17 +686,8 @@ public class PlayServiceImpl implements IPlayService {
688 686 null);
689 687 return;
690 688 }
691   - String stream = null;
692   - if (newMediaServerItem.isRtpEnable()) {
693   - String startTimeStr = startTime.replace("-", "")
694   - .replace(":", "")
695   - .replace(" ", "");
696   - String endTimeTimeStr = endTime.replace("-", "")
697   - .replace(":", "")
698   - .replace(" ", "");
699   - stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
700   - }
701   - SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
  689 + // 录像下载不使用固定流地址,固定流地址会导致如果开始时间与结束时间一致时文件错误的叠加在一起
  690 + SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
702 691 download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback);
703 692 }
704 693  
... ...