Commit 4a34097b682f6dc0327f410e8454276fe7cfefd5
1 parent
988dc36f
录像下载不使用固定地址
Showing
3 changed files
with
15 additions
and
18 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
| @@ -166,6 +166,7 @@ public class SIPRequestHeaderPlarformProvider { | @@ -166,6 +166,7 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 166 | 166 | ||
| 167 | public Request createMessageRequest(ParentPlatform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException { | 167 | public Request createMessageRequest(ParentPlatform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException { |
| 168 | CallIdHeader callIdHeader = SipFactory.getInstance().createHeaderFactory().createCallIdHeader(sendRtpItem.getCallId()); | 168 | CallIdHeader callIdHeader = SipFactory.getInstance().createHeaderFactory().createCallIdHeader(sendRtpItem.getCallId()); |
| 169 | + callIdHeader.setCallId(sendRtpItem.getCallId()); | ||
| 169 | return createMessageRequest(parentPlatform, content, sendRtpItem.getToTag(), SipUtils.getNewViaTag(), sendRtpItem.getFromTag(), callIdHeader); | 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,9 +111,20 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 111 | logger.warn("[收到ACK]:未找到通道({})的推流信息", channelId); | 111 | logger.warn("[收到ACK]:未找到通道({})的推流信息", channelId); |
| 112 | return; | 112 | return; |
| 113 | } | 113 | } |
| 114 | + // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤 | ||
| 115 | + if (sendRtpItem.isTcpActive()) { | ||
| 116 | + logger.info("收到ACK,rtp/{} TCP主动方式后续处理", sendRtpItem.getStreamId()); | ||
| 117 | + return; | ||
| 118 | + } | ||
| 114 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; | 119 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| 115 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 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 | Map<String, Object> param = new HashMap<>(12); | 128 | Map<String, Object> param = new HashMap<>(12); |
| 118 | param.put("vhost","__defaultVhost__"); | 129 | param.put("vhost","__defaultVhost__"); |
| 119 | param.put("app",sendRtpItem.getApp()); | 130 | param.put("app",sendRtpItem.getApp()); |
| @@ -130,10 +141,6 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -130,10 +141,6 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 130 | // 开启rtcp保活 | 141 | // 开启rtcp保活 |
| 131 | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0"); | 142 | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0"); |
| 132 | } | 143 | } |
| 133 | - // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤 | ||
| 134 | - if (sendRtpItem.isTcpActive()) { | ||
| 135 | - return; | ||
| 136 | - } | ||
| 137 | if (mediaInfo == null) { | 144 | if (mediaInfo == null) { |
| 138 | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance( | 145 | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance( |
| 139 | sendRtpItem.getMediaServerId(), sendRtpItem.getApp(), sendRtpItem.getStreamId(), | 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,7 +12,6 @@ import com.genersoft.iot.vmp.conf.exception.ServiceException; | ||
| 12 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; | 12 | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| 13 | import com.genersoft.iot.vmp.gb28181.bean.*; | 13 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 14 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 14 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 15 | -import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; | ||
| 16 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 15 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 17 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 16 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 18 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 17 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| @@ -39,7 +38,6 @@ import gov.nist.javax.sip.message.SIPResponse; | @@ -39,7 +38,6 @@ import gov.nist.javax.sip.message.SIPResponse; | ||
| 39 | import org.slf4j.Logger; | 38 | import org.slf4j.Logger; |
| 40 | import org.slf4j.LoggerFactory; | 39 | import org.slf4j.LoggerFactory; |
| 41 | import org.springframework.beans.factory.annotation.Autowired; | 40 | import org.springframework.beans.factory.annotation.Autowired; |
| 42 | -import org.springframework.data.redis.core.RedisTemplate; | ||
| 43 | import org.springframework.stereotype.Service; | 41 | import org.springframework.stereotype.Service; |
| 44 | import org.springframework.util.ObjectUtils; | 42 | import org.springframework.util.ObjectUtils; |
| 45 | 43 | ||
| @@ -688,17 +686,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -688,17 +686,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 688 | null); | 686 | null); |
| 689 | return; | 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 | download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback); | 691 | download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback); |
| 703 | } | 692 | } |
| 704 | 693 |