gemercheung пре 3 година
родитељ
комит
6b71eff3df
2 измењених фајлова са 28 додато и 20 уклоњено
  1. 1 1
      src/move/move.service.ts
  2. 27 19
      src/scene/scene.service.ts

+ 1 - 1
src/move/move.service.ts

@@ -284,7 +284,7 @@ export class MoveService implements OnModuleInit {
     );
     const user = this.users[userId];
     let i;
-    for (i = 1; i < moveFrames.length; i += 3) {
+    for (i = 1; i < moveFrames.length; i += 5) {
       const moveFrame = moveFrames[i];
       const reply = JSON.parse(JSON.stringify(this.reply));
       reply.traceIds.push(traceId);

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

@@ -25,7 +25,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
     private rotateService: RotateService,
     private moveService: MoveService,
     private getRouterService: GetRouterService, // @InjectQueue('rotate') private rotateQueue: Queue, // @InjectQueue('walking') private walkingQueue: Queue,
-  ) {}
+  ) { }
   @Client(grpcClientOptions) private readonly client: ClientGrpc;
 
   public _frameInteval: NodeJS.Timeout;
@@ -60,6 +60,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
   private walkingSub: any;
   private joystickSub: any;
   private clickQueueSub: any;
+  private _rotateCurrentFame = -1;
 
   private streamServiceSub: any;
   // private roRequestQueue: RxQueue = new DelayQueue(20);
@@ -296,8 +297,6 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
       } else {
         // 正常rotate
         redisMeta = await this.rotateService.seqExeRotate(request);
-        //this.logger.log(redisMeta);
-        //debugger;
       }
 
       if (redisMeta && 'mediaSrc' in redisMeta) {
@@ -678,14 +677,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
         };
         this.logger.log(
           '[media-move]: ' +
-            ', moveframeCnt: ' +
-            this.moveframeCnt +
-            ', clipPath: ' +
-            stream.clipPath +
-            ', mType: ' +
-            stream.mType +
-            ', DIR: ' +
-            stream.DIR,
+          ', moveframeCnt: ' +
+          this.moveframeCnt +
+          ', clipPath: ' +
+          stream.clipPath +
+          ', mType: ' +
+          stream.mType +
+          ', DIR: ' +
+          stream.DIR,
           // stream.metaData,
         );
         this.logger.log(
@@ -860,19 +859,28 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
           this.rotateframeCnt += 1;
 
           stream.frame = this.rotateframeCnt;
-          stream.DIR = this.rotateFirstIDR ? 1 : 3;
+          this._rotateCurrentFame = this.rotateframeCnt;
+
+          const IDRflag = this._rotateCurrentFame % 5 === 0 ? 1 : 3;
+          this.logger.log(
+            `当前rotate ,mainframeCnt:${this.frameCnt.getValue()}, rotateframeCnt:${
+              this.rotateframeCnt
+            } IDRflag:${IDRflag}`,
+          );
+          stream.DIR = this.rotateFirstIDR ? 1 : IDRflag;
+
           if (this.rotateFirstIDR) {
             this.rotateFirstIDR = false;
           }
 
           this.logger.log(
             '[media-rotate]: ' +
-              ', frame: ' +
-              stream.frame +
-              ', rotateframeCnt: ' +
-              this.rotateframeCnt +
-              ', clipPath: ' +
-              stream.clipPath,
+            ', frame: ' +
+            stream.frame +
+            ', rotateframeCnt: ' +
+            this.rotateframeCnt +
+            ', clipPath: ' +
+            stream.clipPath,
             // stream.metaData,
           );
           // this.logger.log(
@@ -942,7 +950,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
                 delete redisData.mediaSrc;
                 this.logger.log(
                   `user:${this.user_id}:first render stream` +
-                    JSON.stringify({ path: clipPath, meta: redisData }),
+                  JSON.stringify({ path: clipPath, meta: redisData }),
                 );
                 const status = await this.pushFirstRender(
                   clipPath,