From 96bb3814f65edb36327eb02f2ea1beed30f06dfc Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 08 十一月 2022 20:43:25 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into wvp-28181-2.0-multi-network

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
index b965254..ae76b95 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
@@ -1,7 +1,8 @@
 package com.genersoft.iot.vmp.vmanager.gb28181.play;
 
-import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson2.JSONArray;
 import com.genersoft.iot.vmp.common.StreamInfo;
+import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
 import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
@@ -32,11 +33,13 @@
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 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.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
 import javax.sip.InvalidArgumentException;
 import javax.sip.SipException;
 import java.text.ParseException;
@@ -78,18 +81,25 @@
 	@Autowired
 	private IMediaServerService mediaServerService;
 
+	@Autowired
+	private UserSetting userSetting;
+
 	@Operation(summary = "寮�濮嬬偣鎾�")
 	@Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true)
 	@Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true)
 	@GetMapping("/start/{deviceId}/{channelId}")
-	public DeferredResult<WVPResult<String>> play(@PathVariable String deviceId,
-													   @PathVariable String channelId) {
+	public DeferredResult<WVPResult<StreamInfo>> play(HttpServletRequest request, @PathVariable String deviceId,
+													  @PathVariable String channelId) {
 
 		// 鑾峰彇鍙敤鐨剒lm
 		Device device = storager.queryVideoDevice(deviceId);
 		MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
 		PlayResult playResult = playService.play(newMediaServerItem, deviceId, channelId, null, null, null);
-
+		playResult.getResult().onCompletion(()->{
+			WVPResult<StreamInfo> result = (WVPResult<StreamInfo>)playResult.getResult().getResult();
+			result.getData().channgeStreamIp(request.getLocalAddr());
+			playResult.getResult().setResult(result);
+		});
 		return playResult.getResult();
 	}
 

--
Gitblit v1.8.0