mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-27 15:37:50 +08:00
修复配置“sip-use-source-ip-as-remote-address”为true时,播放和回放功能正确处理地址
This commit is contained in:
parent
1654683da7
commit
7ab9d8a90c
@ -35,6 +35,8 @@ import org.springframework.web.context.request.async.DeferredResult;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -113,9 +115,16 @@ public class PlayController {
|
|||||||
resultStream.setCode(wvpResult1.getCode());
|
resultStream.setCode(wvpResult1.getCode());
|
||||||
resultStream.setMsg(wvpResult1.getMsg());
|
resultStream.setMsg(wvpResult1.getMsg());
|
||||||
if (wvpResult1.getCode() == ErrorCode.SUCCESS.getCode()) {
|
if (wvpResult1.getCode() == ErrorCode.SUCCESS.getCode()) {
|
||||||
StreamInfo data = wvpResult1.getData().clone();
|
|
||||||
if (userSetting.getUseSourceIpAsStreamIp()) {
|
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||||
data.channgeStreamIp(request.getLocalName());
|
StreamInfo data = wvpResult1.getData().clone();
|
||||||
|
String host="";
|
||||||
|
try {
|
||||||
|
URL url = new URL(request.getRequestURL().toString());
|
||||||
|
host=url.getHost();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
host=request.getLocalName();
|
||||||
|
}
|
||||||
|
data.channgeStreamIp(host);
|
||||||
}
|
}
|
||||||
resultStream.setData(new StreamContent(wvpResult1.getData()));
|
resultStream.setData(new StreamContent(wvpResult1.getData()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,8 +31,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
|||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
import org.springframework.web.context.request.async.DeferredResult;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ public class PlaybackController {
|
|||||||
@Parameter(name = "startTime", description = "开始时间", required = true)
|
@Parameter(name = "startTime", description = "开始时间", required = true)
|
||||||
@Parameter(name = "endTime", description = "结束时间", required = true)
|
@Parameter(name = "endTime", description = "结束时间", required = true)
|
||||||
@GetMapping("/start/{deviceId}/{channelId}")
|
@GetMapping("/start/{deviceId}/{channelId}")
|
||||||
public DeferredResult<WVPResult<StreamContent>> start(@PathVariable String deviceId, @PathVariable String channelId,
|
public DeferredResult<WVPResult<StreamContent>> start(HttpServletRequest request, @PathVariable String deviceId, @PathVariable String channelId,
|
||||||
String startTime, String endTime) {
|
String startTime, String endTime) {
|
||||||
|
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
@ -97,6 +100,17 @@ public class PlaybackController {
|
|||||||
wvpResult.setCode(playBackResult.getCode());
|
wvpResult.setCode(playBackResult.getCode());
|
||||||
wvpResult.setMsg(playBackResult.getMsg());
|
wvpResult.setMsg(playBackResult.getMsg());
|
||||||
if (playBackResult.getCode() == ErrorCode.SUCCESS.getCode()) {
|
if (playBackResult.getCode() == ErrorCode.SUCCESS.getCode()) {
|
||||||
|
if (userSetting.getUseSourceIpAsStreamIp()) {
|
||||||
|
StreamInfo data = ((StreamInfo)playBackResult.getData()).clone();
|
||||||
|
String host="";
|
||||||
|
try {
|
||||||
|
URL url = new URL(request.getRequestURL().toString());
|
||||||
|
host=url.getHost();
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
host=request.getLocalName();
|
||||||
|
}
|
||||||
|
data.channgeStreamIp(host);
|
||||||
|
}
|
||||||
StreamInfo streamInfo = (StreamInfo)playBackResult.getData();
|
StreamInfo streamInfo = (StreamInfo)playBackResult.getData();
|
||||||
wvpResult.setData(new StreamContent(streamInfo));
|
wvpResult.setData(new StreamContent(streamInfo));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user