gemercheung 3 år sedan
förälder
incheckning
251d8781fe
1 ändrade filer med 11 tillägg och 5 borttagningar
  1. 11 5
      src/scene/stream/stream.service.ts

+ 11 - 5
src/scene/stream/stream.service.ts

@@ -216,15 +216,21 @@ 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()) {
-            const isPush = await this.channel.sendMessageBinary(
+            isPush = this.channel.sendMessageBinary(
               Buffer.from(framePack.buffer),
             );
             if (!isPush) {
               await this.sleep(5);
-              console.error('流测试推不成功-再试', isPush);
+              console.error('流测试推不成功-1试', isPush);
+              isPush = this.channel.sendMessageBinary(
+                Buffer.from(framePack.buffer),
+              );
+              if (!isPush) {
+                console.error('流测试推不成功-2试', isPush);
+              }
             }
 
             if (i === slices) {
@@ -259,7 +265,7 @@ export class StreamService {
         console.log(
           'stream-size %s : frame: %s, IDR: %s',
           ((coordBuff.byteLength + clipBuffer.byteLength) / 1024).toFixed(2) +
-            ' KB',
+          ' KB',
           frame,
           dir,
         );
@@ -334,7 +340,7 @@ export class StreamService {
         console.log(
           'stream-size %s : frame: %s, IDR: %s',
           ((coordBuff.byteLength + clipBuffer.byteLength) / 1024).toFixed(2) +
-            ' KB',
+          ' KB',
           frame,
           dir,
         );