gemercheung 3 年 前
コミット
5c3b7a815f
1 ファイル変更19 行追加19 行削除
  1. 19 19
      src/scene/stream/stream.service.ts

+ 19 - 19
src/scene/stream/stream.service.ts

@@ -214,30 +214,30 @@ export class StreamService {
           framePack.setUint32(this.block - 4, steamByteLength);
           steamByteLength += currentSlice.byteLength;
           // const isLastFrame = framePack.byteLength - this.chunk_size < 0;
-          let isPush: boolean;
+
           // this.logger.log('statusPack', statusPack);
           if (this.channel && this.channel.isOpen()) {
-            isPush = this.channel.sendMessageBinary(
+            const isPush = this.channel.sendMessageBinary(
               Buffer.from(framePack.buffer),
             );
-          }
-
-          if (i === slices) {
-            this.onSteaming.next(false);
-            steamByteLength = 0;
-            if (isPush) {
-              // debugger;
-              const stop = performance.now();
-              const inMillSeconds = stop - start;
-              const rounded = Number(inMillSeconds).toFixed(3);
-              this.logger.log(
-                `[timer]-当前流:${stream.clipPath}流耗时-->${rounded}ms`,
-              );
-              return resolve({ frame: stream.frame, done: true });
-            } else {
-              return resolve({ frame: stream.frame, done: false });
+            if (i === slices) {
+              this.onSteaming.next(false);
+              steamByteLength = 0;
+              if (isPush) {
+                // debugger;
+                const stop = performance.now();
+                const inMillSeconds = stop - start;
+                const rounded = Number(inMillSeconds).toFixed(3);
+                this.logger.log(
+                  `[timer]-当前流:${stream.clipPath}流耗时-->${rounded}ms`,
+                );
+                return resolve({ frame: stream.frame, done: true });
+              } else {
+                return resolve({ frame: stream.frame, done: false });
+              }
             }
-
+          } else {
+            return resolve({ frame: stream.frame, done: false });
           }
         }
         // let steamByteLength = 0;