diff --git a/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java index d10c7fb..81b7bd0 100644 --- a/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java +++ b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/service/gb28181/Gb28181DownloadService.java @@ -51,7 +51,6 @@ import org.springframework.stereotype.Service; import javax.sdp.Connection; import javax.sdp.SdpFactory; import javax.sdp.TimeDescription; -import javax.sip.ListeningPoint; import javax.sip.header.CallIdHeader; import javax.sip.message.Request; import javax.sip.message.Response; @@ -221,18 +220,24 @@ public class Gb28181DownloadService { timeField.setStartTime(start); timeField.setStopTime(end); TimeDescription timeDescription = SdpFactory.getInstance().createTimeDescription(timeField); - GB28181Description gb28181Description = MediaSdpHelper.build(MediaSdpHelper.Action.DOWNLOAD, gbDeviceId, channel, Connection.IP4, ip, port, ssrc, streamMode, timeDescription); - gb28181Description.setSessionName(SdpFactory.getInstance().createSessionName(MediaSdpHelper.Action.DOWNLOAD.getAction())); + MediaSdpHelper.Action action = MediaSdpHelper.Action.DOWNLOAD; + if(proxySipConfig.isUsePlaybackToDownload()){ + action = MediaSdpHelper.Action.PLAY_BACK; + } + GB28181Description gb28181Description = MediaSdpHelper.build(action, gbDeviceId, channel, Connection.IP4, ip, port, ssrc, streamMode, timeDescription); + gb28181Description.setSessionName(SdpFactory.getInstance().createSessionName(action.getAction())); gb28181Description.setTimeDescriptions(new Vector<>(){{add(timeDescription);}}); MediaDescriptionImpl media = (MediaDescriptionImpl) gb28181Description.getMediaDescriptions(true).get(0); if(proxySipConfig.getStreamMode() != StreamMode.UDP){ media.getMedia().setProtocol("RTP/AVP/TCP"); } - media.setAttribute("downloadspeed", String.valueOf(4)); + if(!proxySipConfig.isUsePlaybackToDownload()){ + media.setAttribute("downloadspeed", String.valueOf(4)); + } URIField uriField = new URIField(); uriField.setURI(StringUtils.joinWith(":", channel, "0")); gb28181Description.setURI(uriField); - sender.sendRequest(inviteRequest(docking, device, gb28181Description, MediaSdpHelper.Action.DOWNLOAD, ssrc, streamId, result, time)); + sender.sendRequest(inviteRequest(docking, device, gb28181Description, action, ssrc, streamId, result, time)); return result; }