Sfoglia il codice sorgente

回放视频数判断

gao.qiang 1 mese fa
parent
commit
66027a06ca

+ 10 - 6
hazard-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java

@@ -547,9 +547,9 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
      */
     public static String getRecordUrl(String cameraCode, String channel, Date startTm, Date endTm) {
         log.info("getRecordUrl--->" + cameraCode + "--" + channel + "--" + startTm + "--" + endTm);
-        Integer count = streamPathCount();
+        Integer count = streamPathCount(cameraCode);
         log.info("getRecordUrl--count->" + count);
-        if (count>3){
+        if (count>1){
             return "目前回放视频数已超过带宽限制,请您稍后重试";
         }
         log.info(bakUrl + "/gb28181/api/invite?id=" + cameraCode + "&channel=" + channel + "&startTime=" + startTm.getTime()/1000 + "&endTime=" + endTm.getTime()/1000);
@@ -630,7 +630,7 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
     }
 
 
-    public static Integer streamPathCount() {
+    public static Integer streamPathCount(String code) {
         int maxRetries = 5;
         int retryCount = 0;
         int count=0;
@@ -657,15 +657,19 @@ ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
                 JSONObject subObj = streamArray.getJSONObject(i);
                 String streamPath = subObj.getString("StreamPath");
                 log.info("---------streamPath-----" + streamPath);
-                //判断streamPath中/的个数是否大于等于2
-                if (streamPath.split("/").length >= 2) {
-                    count++;
+                //判断streamPath中是否包含code
+                if (streamPath.contains(code)) {
+                    //判断streamPath中/是否大于等于2
+                    if (streamPath.split("/").length > 2) {
+                        count++;
+                    }
                 }
             }
         }
         return count;
     }
 
+
     /**
      * 定时任务参数flv文件
      * -----------------------------废弃