gemercheung 3 년 전
부모
커밋
9a307d7f5f
3개의 변경된 파일19개의 추가작업 그리고 15개의 파일을 삭제
  1. 4 3
      src/meta.gateway.ts
  2. 14 11
      src/scene/scene.service.ts
  3. 1 1
      src/scene/stream/stream.service.ts

+ 4 - 3
src/meta.gateway.ts

@@ -35,11 +35,12 @@ initLogger('Debug');
   path: '/ws',
 })
 export class MetaGateway
-  implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
+  implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect
+{
   constructor(
     private readonly sceneService: SceneService,
     private readonly configService: ConfigService,
-  ) { }
+  ) {}
   private logger: Logger = new Logger('MetaGateway');
   private peer: PeerConnection = null;
   private timer: NodeJS.Timeout;
@@ -282,7 +283,7 @@ export class MetaGateway
           }
         },
       );
-    } catch (error) { }
+    } catch (error) {}
   }
 
   handleConnection(client: WebSocket, ...args: any[]) {

+ 14 - 11
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;
@@ -337,14 +337,16 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
 
   async walking(req) {
     try {
-      if (this.clickQueueSub) {
-        this.clickQueueSub.unsubscribe();
-        this.clickQueueSub = null;
-      }
-      this.clickQueue.next(req);
-      console.log('walking', this.clickQueueSub, JSON.stringify(req));
+      // if (this.clickQueueSub) {
+      //   this.clickQueueSub.unsubscribe();
+      //   this.clickQueueSub = null;
+      // }
+      // this.clickQueue.next(req);
+      // console.log('walking', this.clickQueueSub, JSON.stringify(req));
       // if (!this.clickQueueSub) {
-      this.clickQueueSub = this.clickQueue.subscribe(async (request) => {
+      // this.clickQueueSub = this.clickQueue.subscribe(async (request) => {
+
+      if (!this.onMoving.getValue()) {
         const start = performance.now();
         const user = this.moveService.users[this.user_id];
         console.log('进入1 - searchRoad');
@@ -361,7 +363,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
           return;
         }
         // debugger;
-        const walkingRes = await this.moveService.move(path, request);
+        const walkingRes = await this.moveService.move(path, req);
 
         // console.log('walking', walkingRes);
         // debugger;
@@ -422,7 +424,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
             this.resumeStream();
           }
         }
-      });
+      }
+      // });
       // }
     } catch (error) {
       this.logger.error('walking', error);
@@ -768,7 +771,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,

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

@@ -19,7 +19,7 @@ export class StreamService {
     clipPath: '',
     metaData: '',
   });
-  constructor(private cacheService: CacheService) { }
+  constructor(private cacheService: CacheService) {}
 
   setChannel(channel: DataChannel) {
     this.channel = channel;