Commit 4005962c5ba25d1c34e4513d9b9ad27722de97a8

Authored by 648540858
Committed by GitHub
2 parents 0dc01770 8801c774

Merge pull request #30 from lawrencehj/master

与2.0同步修正部分错误
... ... @@ -131,7 +131,7 @@
131 131 <artifactId>jain-sip-ri</artifactId>
132 132 <version>1.3.0-92</version>
133 133 <scope>system</scope>
134   - <systemPath>${project.basedir}/libs/jain-sip-ri-1.3.0-92.jar</systemPath>
  134 + <systemPath>${pom.basedir}/libs/jain-sip-ri-1.3.0-92.jar</systemPath>
135 135 </dependency>
136 136 <dependency>
137 137 <groupId>log4j</groupId>
... ... @@ -141,7 +141,7 @@
141 141  
142 142 <!-- xml解析库 -->
143 143 <dependency>
144   - <groupId>org.dom4j</groupId>
  144 + <groupId>org.dom4j</groupId>
145 145 <artifactId>dom4j</artifactId>
146 146 <version>2.1.3</version>
147 147 </dependency>
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
... ... @@ -77,6 +77,9 @@ public class SIPCommander implements ISIPCommander {
77 77 @Value("${media.seniorSdp}")
78 78 private boolean seniorSdp;
79 79  
  80 + @Value("${media.autoApplyPlay}")
  81 + private boolean autoApplyPlay;
  82 +
80 83 @Autowired
81 84 private ZLMHttpHookSubscribe subscribe;
82 85  
... ... @@ -182,11 +185,11 @@ public class SIPCommander implements ISIPCommander {
182 185 /**
183 186 * 云台指令码计算
184 187 *
185   - * @param cmdCode 指令码
186   - * @param parameter1 数据1
187   - * @param parameter2 数据2
188   - * @param combineCode2 组合码2
189   - */
  188 + * @param cmdCode 指令码
  189 + * @param parameter1 数据1
  190 + * @param parameter2 数据2
  191 + * @param combineCode2 组合码2
  192 + */
190 193 public static String frontEndCmdString(int cmdCode, int parameter1, int parameter2, int combineCode2) {
191 194 StringBuilder builder = new StringBuilder("A50F01");
192 195 String strTmp;
... ... @@ -208,13 +211,13 @@ public class SIPCommander implements ISIPCommander {
208 211 /**
209 212 * 云台控制,支持方向与缩放控制
210 213 *
211   - * @param device 控制设备
212   - * @param channelId 预览通道
213   - * @param leftRight 镜头左移右移 0:停止 1:左移 2:右移
214   - * @param upDown 镜头上移下移 0:停止 1:上移 2:下移
215   - * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
216   - * @param moveSpeed 镜头移动速度
217   - * @param zoomSpeed 镜头缩放速度
  214 + * @param device 控制设备
  215 + * @param channelId 预览通道
  216 + * @param leftRight 镜头左移右移 0:停止 1:左移 2:右移
  217 + * @param upDown 镜头上移下移 0:停止 1:上移 2:下移
  218 + * @param inOut 镜头放大缩小 0:停止 1:缩小 2:放大
  219 + * @param moveSpeed 镜头移动速度
  220 + * @param zoomSpeed 镜头缩放速度
218 221 */
219 222 @Override
220 223 public boolean ptzCmd(Device device, String channelId, int leftRight, int upDown, int inOut, int moveSpeed,
... ... @@ -287,8 +290,12 @@ public class SIPCommander implements ISIPCommander {
287 290 @Override
288 291 public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
289 292 try {
290   -
291   - String ssrc = streamSession.createPlaySsrc();
  293 + String ssrc = "";
  294 + if (rtpEnable) {
  295 + ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
  296 + }else {
  297 + ssrc = streamSession.createPlaySsrc();
  298 + }
292 299 String streamId = null;
293 300 if (rtpEnable) {
294 301 streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
... ... @@ -326,13 +333,14 @@ public class SIPCommander implements ISIPCommander {
326 333  
327 334 if (seniorSdp) {
328 335 if("TCP-PASSIVE".equals(streamMode)) {
329   - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
  336 + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
330 337 }else if ("TCP-ACTIVE".equals(streamMode)) {
331   - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
  338 + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
332 339 }else if("UDP".equals(streamMode)) {
333   - content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
  340 + content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n");
334 341 }
335 342 content.append("a=recvonly\r\n");
  343 + content.append("a=rtpmap:96 PS/90000\r\n");
336 344 content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
337 345 content.append("a=rtpmap:126 H264/90000\r\n");
338 346 content.append("a=rtpmap:125 H264S/90000\r\n");
... ... @@ -341,7 +349,6 @@ public class SIPCommander implements ISIPCommander {
341 349 content.append("a=fmtp:99 profile-level-id=3\r\n");
342 350 content.append("a=rtpmap:98 H264/90000\r\n");
343 351 content.append("a=rtpmap:97 MPEG4/90000\r\n");
344   - content.append("a=rtpmap:96 PS/90000\r\n");
345 352 if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
346 353 content.append("a=setup:passive\r\n");
347 354 content.append("a=connection:new\r\n");
... ... @@ -380,9 +387,6 @@ public class SIPCommander implements ISIPCommander {
380 387  
381 388 content.append("y="+ssrc+"\r\n");//ssrc
382 389  
383   -// String fromTag = UUID.randomUUID().toString();
384   -// Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, fromTag, null, ssrc);
385   -
386 390 Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc);
387 391  
388 392 ClientTransaction transaction = transmitRequest(device, request, errorEvent);
... ... @@ -408,8 +412,16 @@ public class SIPCommander implements ISIPCommander {
408 412 , SipSubscribe.Event errorEvent) {
409 413 try {
410 414 MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
411   - String ssrc = streamSession.createPlayBackSsrc();
412   - String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
  415 + String ssrc = null;
  416 + String streamId = null;
  417 + if (rtpEnable) {
  418 + ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId);
  419 + streamId = ssrc;
  420 + }else {
  421 + ssrc = streamSession.createPlayBackSsrc();
  422 + streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
  423 + }
  424 +
413 425 // 添加订阅
414 426 JSONObject subscribeKey = new JSONObject();
415 427 subscribeKey.put("app", "rtp");
... ... @@ -417,7 +429,6 @@ public class SIPCommander implements ISIPCommander {
417 429  
418 430 subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event);
419 431  
420   - //
421 432 StringBuffer content = new StringBuffer(200);
422 433 content.append("v=0\r\n");
423 434 content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n");
... ... @@ -437,13 +448,14 @@ public class SIPCommander implements ISIPCommander {
437 448  
438 449 if (seniorSdp) {
439 450 if("TCP-PASSIVE".equals(streamMode)) {
440   - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
  451 + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
441 452 }else if ("TCP-ACTIVE".equals(streamMode)) {
442   - content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
  453 + content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
443 454 }else if("UDP".equals(streamMode)) {
444   - content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
  455 + content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n");
445 456 }
446 457 content.append("a=recvonly\r\n");
  458 + content.append("a=rtpmap:96 PS/90000\r\n");
447 459 content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
448 460 content.append("a=rtpmap:126 H264/90000\r\n");
449 461 content.append("a=rtpmap:125 H264S/90000\r\n");
... ... @@ -452,7 +464,6 @@ public class SIPCommander implements ISIPCommander {
452 464 content.append("a=fmtp:99 profile-level-id=3\r\n");
453 465 content.append("a=rtpmap:98 H264/90000\r\n");
454 466 content.append("a=rtpmap:97 MPEG4/90000\r\n");
455   - content.append("a=rtpmap:96 PS/90000\r\n");
456 467 if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
457 468 content.append("a=setup:passive\r\n");
458 469 content.append("a=connection:new\r\n");
... ... @@ -521,9 +532,6 @@ public class SIPCommander implements ISIPCommander {
521 532 if (dialog == null) {
522 533 return;
523 534 }
524   -
525   -
526   -
527 535 Request byeRequest = dialog.createRequest(Request.BYE);
528 536 SipURI byeURI = (SipURI) byeRequest.getRequestURI();
529 537 String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString();
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
... ... @@ -297,7 +297,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
297 297 device.setStreamMode("UDP");
298 298 }
299 299 storager.updateDevice(device);
300   - cmder.catalogQuery(device, null);
  300 + //cmder.catalogQuery(device, null);
301 301 // 回复200 OK
302 302 responseAck(evt);
303 303 if (offLineDetector.isOnline(deviceId)) {
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
... ... @@ -19,15 +19,6 @@ public interface DeviceChannelMapper {
19 19 "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})")
20 20 int add(DeviceChannel channel);
21 21  
22   -// @Update("UPDATE device_channel " +
23   -// "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " +
24   -// "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " +
25   -// "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " +
26   -// "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " +
27   -// "hasAudio=#{hasAudio}" +
28   -// "WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
29   -
30   -
31 22 @Update(value = {" <script>" +
32 23 "UPDATE device_channel " +
33 24 "SET deviceId='${deviceId}'" +
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceController.java
... ... @@ -63,13 +63,6 @@ public class DeviceController {
63 63  
64 64 /**
65 65 * 分页查询通道数
66   - * @param deviceId 设备id
67   - * @param page 当前页
68   - * @param count 每页条数
69   - * @return 通道列表
70   - */
71   - /**
72   - * 分页查询通道数
73 66 *
74 67 * @param deviceId 设备id
75 68 * @param page 当前页
... ...
src/main/java/com/genersoft/iot/vmp/vmanager/play/PlayController.java
... ... @@ -169,7 +169,6 @@ public class PlayController {
169 169 // 超时处理
170 170 result.onTimeout(()->{
171 171 logger.warn(String.format("设备预览/回放停止超时,streamId:%s ", streamId));
172   -
173 172 RequestMessage msg = new RequestMessage();
174 173 msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid);
175 174 msg.setData("Timeout");
... ...
src/main/java/com/genersoft/iot/vmp/web/ApiStreamController.java
... ... @@ -39,8 +39,6 @@ public class ApiStreamController {
39 39 @Autowired
40 40 private IRedisCatchStorage redisCatchStorage;
41 41  
42   - private boolean closeWaitRTPInfo = false;
43   -
44 42  
45 43 @Autowired
46 44 private ZLMRESTfulUtils zlmresTfulUtils;
... ...
web_src/src/components/channelList.vue
... ... @@ -44,8 +44,8 @@
44 44 <el-table-column label="状态" width="180" align="center">
45 45 <template slot-scope="scope">
46 46 <div slot="reference" class="name-wrapper">
47   - <el-tag size="medium" v-if="scope.row.status == 1">在线</el-tag>
48   - <el-tag size="medium" type="info" v-if="scope.row.status == 0">离线</el-tag>
  47 + <el-tag size="medium" v-if="scope.row.status == 1">开启</el-tag>
  48 + <el-tag size="medium" type="info" v-if="scope.row.status == 0">关闭</el-tag>
49 49 </div>
50 50 </template>
51 51 </el-table-column>
... ... @@ -99,14 +99,14 @@ export default {
99 99 total: 0,
100 100 beforeUrl: "/videoList",
101 101 isLoging: false,
102   - autoList: false
  102 + autoList: true
103 103 };
104 104 },
105 105  
106 106 mounted() {
107 107 this.initData();
108 108 if (this.autoList) {
109   - this.updateLooper = setInterval(this.initData, 1500);
  109 + this.updateLooper = setInterval(this.initData, 5000);
110 110 }
111 111  
112 112 },
... ... @@ -179,7 +179,7 @@ export default {
179 179  
180 180 //通知设备上传媒体流
181 181 sendDevicePush: function (itemData) {
182   - console.log(itemData)
  182 + console.log(itemData);
183 183 let deviceId = this.deviceId;
184 184 this.isLoging = true;
185 185 let channelId = itemData.channelId;
... ...
web_src/src/components/gb28181/devicePlayer.vue
... ... @@ -67,7 +67,7 @@
67 67 <div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 1)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-in control-zoom-btn" style="font-size: 1.875rem;"></i></div>
68 68 <div style="position: absolute; left: 7.25rem; top: 3.25rem; font-size: 1.875rem;" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out control-zoom-btn"></i></div>
69 69 <div class="contro-speed" style="position: absolute; left: 4px; top: 7rem; width: 9rem;">
70   - <el-slider v-model="controSpeed"></el-slider>
  70 + <el-slider v-model="controSpeed" :max="255"></el-slider>
71 71 </div>
72 72 </div>
73 73  
... ...
web_src/src/components/videoList.vue
... ... @@ -52,7 +52,7 @@
52 52 <el-table-column label="操作" width="240" align="center" fixed="right">
53 53 <template slot-scope="scope">
54 54 <el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh" @click="refDevice(scope.row)">刷新通道</el-button>
55   - <el-button size="mini" icon="el-icon-s-open" type="primary" @click="showChannelList(scope.row)">查看通道</el-button>
  55 + <el-button size="mini" icon="el-icon-s-open" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)">查看通道</el-button>
56 56 </template>
57 57 </el-table-column>
58 58 </el-table>
... ...