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