Browse Source

fixed flush max

gemercheung 3 years ago
parent
commit
2628f4384b
1 changed files with 8 additions and 6 deletions
  1. 8 6
      src/h264Decoder/VDecoder.js

+ 8 - 6
src/h264Decoder/VDecoder.js

@@ -131,12 +131,14 @@ export class VDecoder extends EventEmitter {
       this.decode(nextFrame, tempId);
     } else {
       const clip = this.tempVideos.find(({ id }) => id === this.decodingId);
-      const fps = (1000 / (Date.now() - this.start)) * clip.data.length;
-      console.log(
-        `Decoded ${clip.data.length} frames in ${Date.now() - this.start}ms @ ${
-          fps >> 0
-        }FPS`
-      );
+      if (clip) {
+        const fps = (1000 / (Date.now() - this.start)) * clip.data.length;
+        console.log(
+          `Decoded ${clip.data.length} frames in ${
+            Date.now() - this.start
+          }ms @ ${fps >> 0}FPS`
+        );
+      }
 
       this.decoding = false;
       this.decodingId = null;