gemercheung 3 лет назад
Родитель
Сommit
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);