gemercheung 3 年之前
父节点
当前提交
cbdc50a67b
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      src/h264Decoder/VDecoder.js

+ 9 - 1
src/h264Decoder/VDecoder.js

@@ -48,7 +48,10 @@ export class VDecoder extends EventEmitter {
       switch (message.type) {
         case "pictureReady":
           //   onPictureReady(message);
-          console.log("[VDecoder]::decodeData", Object.assign(message, { clipId: this.decodingId }));
+          console.log(
+            "[VDecoder]::decodeData",
+            Object.assign(message, { clipId: this.decodingId })
+          );
           this.emit(
             "decodeData",
             Object.assign(message, { clipId: this.decodingId })
@@ -86,6 +89,11 @@ export class VDecoder extends EventEmitter {
 
     let rangeFetch = [];
 
+    if (rangeArray[0] < 0 || rangeArray[1] < 0) {
+      console.error("[VDecoder]:range: 非法", `${[rangeArray[0], rangeArray[1]]}`);
+      return
+    }
+
     if (rangeArray[0] < rangeArray[1]) {
       rangeFetch = range(rangeArray[0], rangeArray[1] + 1);
       console.log("[VDecoder]:顺时 +", rangeFetch);