Commit 0f0ece240128795d7e174937a4ee848ef7f3d691

Authored by 648540858
1 parent 958474c6

设备编辑增加收流IP

sql/update.sql
... ... @@ -11,6 +11,9 @@ alter table device
11 11 add custom_name varchar(255) default null;
12 12  
13 13 alter table device
  14 + add sdpIp varchar(50) default null;
  15 +
  16 +alter table device
14 17 add password varchar(255) default null;
15 18  
16 19 alter table device
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
... ... @@ -175,6 +175,9 @@ public class Device {
175 175 @Schema(description = "密码")
176 176 private String password;
177 177  
  178 + @Schema(description = "收流IP")
  179 + private String sdpIp;
  180 +
178 181  
179 182 public String getDeviceId() {
180 183 return deviceId;
... ... @@ -391,4 +394,12 @@ public class Device {
391 394 public void setPassword(String password) {
392 395 this.password = password;
393 396 }
  397 +
  398 + public String getSdpIp() {
  399 + return sdpIp;
  400 + }
  401 +
  402 + public void setSdpIp(String sdpIp) {
  403 + this.sdpIp = sdpIp;
  404 + }
394 405 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
... ... @@ -290,12 +290,17 @@ public class SIPCommander implements ISIPCommander {
290 290 subscribe.removeSubscribe(hookSubscribe);
291 291 }
292 292 });
293   - //
  293 + String sdpIp;
  294 + if (!ObjectUtils.isEmpty(device.getSdpIp())) {
  295 + sdpIp = device.getSdpIp();
  296 + }else {
  297 + sdpIp = mediaServerItem.getSdpIp();
  298 + }
294 299 StringBuffer content = new StringBuffer(200);
295 300 content.append("v=0\r\n");
296   - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  301 + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n");
297 302 content.append("s=Play\r\n");
298   - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  303 + content.append("c=IN IP4 " + sdpIp + "\r\n");
299 304 content.append("t=0 0\r\n");
300 305  
301 306 if (userSetting.isSeniorSdp()) {
... ... @@ -379,13 +384,18 @@ public class SIPCommander implements ISIPCommander {
379 384  
380 385  
381 386 logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
382   -
  387 + String sdpIp;
  388 + if (!ObjectUtils.isEmpty(device.getSdpIp())) {
  389 + sdpIp = device.getSdpIp();
  390 + }else {
  391 + sdpIp = mediaServerItem.getSdpIp();
  392 + }
383 393 StringBuffer content = new StringBuffer(200);
384 394 content.append("v=0\r\n");
385   - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  395 + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n");
386 396 content.append("s=Playback\r\n");
387 397 content.append("u=" + channelId + ":0\r\n");
388   - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  398 + content.append("c=IN IP4 " + sdpIp + "\r\n");
389 399 content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
390 400 + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n");
391 401  
... ... @@ -476,13 +486,18 @@ public class SIPCommander implements ISIPCommander {
476 486 SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
477 487  
478 488 logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
479   -
  489 + String sdpIp;
  490 + if (!ObjectUtils.isEmpty(device.getSdpIp())) {
  491 + sdpIp = device.getSdpIp();
  492 + }else {
  493 + sdpIp = mediaServerItem.getSdpIp();
  494 + }
480 495 StringBuffer content = new StringBuffer(200);
481 496 content.append("v=0\r\n");
482   - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  497 + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n");
483 498 content.append("s=Download\r\n");
484 499 content.append("u=" + channelId + ":0\r\n");
485   - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n");
  500 + content.append("c=IN IP4 " + sdpIp + "\r\n");
486 501 content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
487 502 + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n");
488 503  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
... ... @@ -600,6 +600,7 @@ public class DeviceServiceImpl implements IDeviceService {
600 600 if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {
601 601 updateDeviceChannelGeoCoordSys(device);
602 602 }
  603 + // 更新redis
603 604 deviceMapper.updateCustom(device);
604 605 }
605 606  
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
... ... @@ -24,6 +24,7 @@ public interface DeviceMapper {
24 24 "transport," +
25 25 "streamMode," +
26 26 "ip," +
  27 + "sdpIp," +
27 28 "port," +
28 29 "hostAddress," +
29 30 "expires," +
... ... @@ -52,6 +53,7 @@ public interface DeviceMapper {
52 53 "transport," +
53 54 "streamMode," +
54 55 "ip," +
  56 + "sdpIp," +
55 57 "port," +
56 58 "hostAddress," +
57 59 "expires," +
... ... @@ -77,6 +79,7 @@ public interface DeviceMapper {
77 79 "#{transport}," +
78 80 "#{streamMode}," +
79 81 "#{ip}," +
  82 + "#{sdpIp}," +
80 83 "#{port}," +
81 84 "#{hostAddress}," +
82 85 "#{expires}," +
... ... @@ -125,6 +128,7 @@ public interface DeviceMapper {
125 128 "transport," +
126 129 "streamMode," +
127 130 "ip," +
  131 + "sdpIp," +
128 132 "port," +
129 133 "hostAddress," +
130 134 "expires," +
... ... @@ -160,6 +164,7 @@ public interface DeviceMapper {
160 164 "transport," +
161 165 "streamMode," +
162 166 "ip," +
  167 + "sdpIp," +
163 168 "port," +
164 169 "hostAddress," +
165 170 "expires," +
... ... @@ -188,6 +193,7 @@ public interface DeviceMapper {
188 193 "transport," +
189 194 "streamMode," +
190 195 "ip," +
  196 + "sdpIp," +
191 197 "port," +
192 198 "hostAddress," +
193 199 "expires," +
... ... @@ -214,6 +220,7 @@ public interface DeviceMapper {
214 220 "<if test=\"password != null\">, password='${password}'</if>" +
215 221 "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
216 222 "<if test=\"ip != null\">, ip='${ip}'</if>" +
  223 + "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +
217 224 "<if test=\"port != null\">, port=${port}</if>" +
218 225 "<if test=\"charset != null\">, charset='${charset}'</if>" +
219 226 "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +
... ... @@ -232,6 +239,7 @@ public interface DeviceMapper {
232 239 "deviceId, " +
233 240 "custom_name, " +
234 241 "password, " +
  242 + "sdpIp, " +
235 243 "createTime," +
236 244 "updateTime," +
237 245 "charset," +
... ... @@ -243,6 +251,7 @@ public interface DeviceMapper {
243 251 "#{deviceId}," +
244 252 "#{name}," +
245 253 "#{password}," +
  254 + "#{sdpIp}," +
246 255 "#{createTime}," +
247 256 "#{updateTime}," +
248 257 "#{charset}," +
... ...
web_src/src/components/dialog/configInfo.vue
... ... @@ -19,7 +19,7 @@
19 19 <el-tag size="small">{{configInfoData.sip.password}}</el-tag>
20 20 </el-descriptions-item>
21 21 </el-descriptions>
22   - <el-descriptions title="版本信息"v-if="configInfoData.sip">
  22 + <el-descriptions title="版本信息"v-if="configInfoData.version">
23 23 <el-descriptions-item label="版本">{{configInfoData.version.version}}</el-descriptions-item>
24 24 <el-descriptions-item label="编译时间">{{configInfoData.version.BUILD_DATE}}</el-descriptions-item>
25 25 <el-descriptions-item label="GIT版本">{{configInfoData.version.GIT_Revision_SHORT}}</el-descriptions-item>
... ...
web_src/src/components/dialog/deviceEdit.vue
... ... @@ -22,6 +22,9 @@
22 22 <el-form-item label="密码" prop="password">
23 23 <el-input type="password" v-model="form.password" clearable></el-input>
24 24 </el-form-item>
  25 + <el-form-item label="收流IP" prop="sdpIp">
  26 + <el-input type="sdpIp" v-model="form.sdpIp" clearable></el-input>
  27 + </el-form-item>
25 28 <el-form-item label="流媒体ID" prop="mediaServerId">
26 29 <el-select v-model="form.mediaServerId" style="float: left; width: 100%" >
27 30 <el-option key="auto" label="自动负载最小" value="auto"></el-option>
... ...