gemercheung 3 éve
szülő
commit
a0b80e1169
1 módosított fájl, 12 hozzáadás és 12 törlés
  1. 12 12
      src/scene/scene.service.ts

+ 12 - 12
src/scene/scene.service.ts

@@ -62,7 +62,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   private clickQueue: RxQueue = new DebounceQueue(500);
   private moveQueue: RxQueue = new DelayQueue(30);
   private joystickQueue: RxQueue = new DebounceQueue(500);
-  private requestIFrameQueue: RxQueue = new DebounceQueue(1000);
+  private requestIFrameQueue: RxQueue = new DebounceQueue(2000);
 
   private requestIFrameQueueSub: any;
   private rotateTimeStamp: number;
@@ -578,20 +578,20 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
 
   async handleIframeRequest() {
     //TODO Iframe 最终传什么?
-    this.logger.warn('lostIframe');
+
     this.requestIFrameQueue.next(this.streamService.lastStreamFrame);
-    this.requestIFrameQueueSub = this.requestIFrameQueue.subscribe(
-      (frameData: StreamFrameType) => {
-        const nextFrame = this.frameCnt.getValue() + 1;
-        frameData.frame = nextFrame;
-        this.streamService.pushFrameToSteam(frameData);
-        this.frameCnt.next(nextFrame);
-        this.resumeStream();
-      },
-    );
 
     if (!this.requestIFrameQueueSub) {
-      this.requestIFrameQueueSub.subscribe();
+      this.requestIFrameQueueSub = this.requestIFrameQueue.subscribe(
+        (frameData: StreamFrameType) => {
+          const nextFrame = this.frameCnt.getValue() + 1;
+          this.logger.warn('lostIframe', nextFrame);
+          frameData.frame = nextFrame;
+          this.streamService.pushFrameToSteam(frameData);
+          this.frameCnt.next(nextFrame);
+          this.resumeStream();
+        },
+      );
     }
 
     // const lastStreamFrame = this.streamService.lastStreamFrame.getValue();