Эх сурвалжийг харах

fix:
1. 视频播放接口添加是否开启ps流参数
2. 前端添加是否开启ps控件

kindring 2 жил өмнө
parent
commit
2a66765390

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -374,9 +374,10 @@ public class SIPCommander implements ISIPCommander {
             }
             content.append("a=recvonly\r\n");
             if(isUsePs == 1){
+                // ps 改为手动启用
                 content.append("a=rtpmap:96 PS/90000\r\n");
             }
-            content.append("a=rtpmap:96 PS/90000\r\n");
+//            content.append("a=rtpmap:96 PS/90000\r\n");
             content.append("a=rtpmap:98 H264/90000\r\n");
             content.append("a=rtpmap:97 MPEG4/90000\r\n");
             content.append("a=rtpmap:99 H265/90000\r\n");

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java

@@ -433,7 +433,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
 
                             // 写入redis, 超时时回复
                             redisCatchStorage.updateSendRTPSever(sendRtpItem);
-                            playService.play(mediaServerItem, ssrcInfo, device, channelId, hookEvent, errorEvent, (code, msg) -> {
+                            playService.play(mediaServerItem, ssrcInfo, device, channelId,1, hookEvent, errorEvent, (code, msg) -> {
                                 logger.info("[上级点播]超时, 用户:{}, 通道:{}", username, channelId);
                                 redisCatchStorage.deleteSendRTPServer(platform.getServerGBId(), channelId, callIdHeader.getCallId(), null);
                             }, null);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -665,7 +665,7 @@ public class ZLMHttpHookListener {
 					String channelId = s[1];
 					Device device = redisCatchStorage.getDevice(deviceId);
 					if (device != null) {
-						playService.play(mediaInfo,deviceId, channelId, null, null, null);
+						playService.play(mediaInfo,deviceId, channelId,1, null, null, null);
 					}
 				}
 			}

+ 3 - 0
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java

@@ -213,6 +213,9 @@ public class PlayServiceImpl implements IPlayService {
         if (streamInfo == null) {
             String streamId = null;
             if (mediaServerItem.isRtpEnable()) {
+                logger.info("test ----- {}",device.getDeviceId());
+                logger.info("test ----- {}",channelId);
+
                 streamId = String.format("%s_%s", device.getDeviceId(), channelId);
             }
             SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, device.isSsrcCheck(), false);

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java

@@ -79,7 +79,8 @@ public class PlayController {
 	@Parameter(name = "isUsePs" ,description = "是否启用ps",required = false)
 	@GetMapping("/start/{deviceId}/{channelId}")
 	public DeferredResult<WVPResult<String>> play(@PathVariable String deviceId,
-													   @PathVariable String channelId,@RequestParam int isUsePs) {
+												  @PathVariable String channelId,
+												  @RequestParam(value = "isUsePs", defaultValue = "1", required=false )int isUsePs) {
 		// 获取可用的zlm
 		Device device = storager.queryVideoDevice(deviceId);
 		MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java

@@ -112,7 +112,7 @@ public class ApiStreamController {
             return resultDeferredResult;
         }
         MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
-        PlayResult play = playService.play(newMediaServerItem, serial, code, (mediaServerItem, response)->{
+        PlayResult play = playService.play(newMediaServerItem, serial, code,1, (mediaServerItem, response)->{
             StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(serial, code);
             JSONObject result = new JSONObject();
             result.put("StreamID", streamInfo.getStream());

+ 12 - 2
web_src/src/components/channelList.vue

@@ -8,6 +8,8 @@
       </div>
       <div class="page-header-btn">
         <div v-if="!showTree" style="display: inline;">
+          <el-button size="medium" type="text" @click="switchUsePs()">{{isUsePs?'启用ps':'不启用ps'}}</el-button>
+
           搜索:
           <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字"
                     prefix-icon="el-icon-search" v-model="searchSrt" clearable></el-input>
@@ -161,7 +163,8 @@ export default {
       beforeUrl: "/deviceList",
       isLoging: false,
       showTree: false,
-      loadSnap: {}
+      loadSnap: {},
+      isUsePs: true,
     };
   },
 
@@ -242,16 +245,23 @@ export default {
       this.isLoging = false;
       this.$refs.ptzControl.showPtzControl(deviceId,channelId);
     },
+
+    switchUsePs(){
+      this.isUsePs = !this.isUsePs;
+    },
     //通知设备上传媒体流
     sendDevicePush: function (itemData) {
       let deviceId = this.deviceId;
       this.isLoging = true;
       let channelId = itemData.channelId;
+      let isUsePs = this.isUsePs?1:0;
+      let pushUrl = `/api/play/start/${deviceId}/${channelId}?isUsePs=${isUsePs}`
+      console.log(pushUrl);
       console.log("通知设备推流1:" + deviceId + " : " + channelId);
       let that = this;
       this.$axios({
         method: 'get',
-        url: '/api/play/start/' + deviceId + '/' + channelId
+        url: pushUrl
       }).then(function (res) {
         console.log(res)
         that.isLoging = false;