|
@@ -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;
|
|
@@ -329,8 +329,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (seqs?.length) {
|
|
|
const lastSeq = rotateCamData?.length
|
|
|
? (Array.from(rotateCamData).concat(
|
|
|
- seqs,
|
|
|
- ) as any as StreamReplyType[])
|
|
|
+ seqs,
|
|
|
+ ) as any as StreamReplyType[])
|
|
|
: seqs;
|
|
|
this.handleSeqMoving(lastSeq);
|
|
|
} else {
|
|
@@ -375,8 +375,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
console.log('joystickRes-seqs', seqs.length);
|
|
|
const lastSeq = rotateCamData?.length
|
|
|
? (Array.from(rotateCamData).concat(
|
|
|
- seqs,
|
|
|
- ) as any as StreamReplyType[])
|
|
|
+ seqs,
|
|
|
+ ) as any as StreamReplyType[])
|
|
|
: seqs;
|
|
|
this.handleSeqMoving(lastSeq);
|
|
|
} else {
|
|
@@ -681,7 +681,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,
|
|
@@ -695,6 +695,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.logger.error('first render problem', status);
|
|
|
}
|
|
|
}
|
|
|
+ } else {
|
|
|
+ console.log(`首屏::无数据:${frame}`);
|
|
|
}
|
|
|
}
|
|
|
if (
|
|
@@ -724,44 +726,45 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
handleRotateStream() {
|
|
|
- this.roQueueSubscription = this.roQueue.subscribe(
|
|
|
- async (stream: StreamFrameType) => {
|
|
|
- this.rotateTimeStamp = Date.now();
|
|
|
- if (this.rotateframeCnt === -1) {
|
|
|
- this.rotateframeCnt = this.frameCnt.value;
|
|
|
- }
|
|
|
- this.rotateframeCnt += 1;
|
|
|
-
|
|
|
- stream.frame = this.rotateframeCnt;
|
|
|
- console.log(
|
|
|
- '[media-rotate]',
|
|
|
- stream.frame,
|
|
|
- this.rotateframeCnt,
|
|
|
- stream.clipPath,
|
|
|
- );
|
|
|
- // this.logger.log(
|
|
|
- // `roQueueSubscription:frame:${this.rotateframeCnt} ` +
|
|
|
- // JSON.stringify(stream.metaData),
|
|
|
- // );
|
|
|
-
|
|
|
- const res = await this.streamService.pushFrameToSteam(stream);
|
|
|
- if (res.done) {
|
|
|
- clearTimeout(this._rotateTimeout);
|
|
|
- this._rotateTimeout = setTimeout(() => {
|
|
|
- console.log('rotate 1秒', Date.now());
|
|
|
- console.log('rotate end');
|
|
|
- // const next = res.frame + 1;
|
|
|
- this.frameCnt.next(res.frame);
|
|
|
- this.resumeStream();
|
|
|
- this.rotateframeCnt = -1;
|
|
|
- this.onMoving.next(false);
|
|
|
- this.onRotating.next(false);
|
|
|
- }, 300);
|
|
|
- }
|
|
|
- },
|
|
|
- );
|
|
|
+ if (!this.roQueueSubscription) {
|
|
|
+ this.roQueueSubscription = this.roQueue.subscribe(
|
|
|
+ async (stream: StreamFrameType) => {
|
|
|
+ this.rotateTimeStamp = Date.now();
|
|
|
+ if (this.rotateframeCnt === -1) {
|
|
|
+ this.rotateframeCnt = this.frameCnt.value;
|
|
|
+ }
|
|
|
+ this.rotateframeCnt += 1;
|
|
|
+
|
|
|
+ stream.frame = this.rotateframeCnt;
|
|
|
+ console.log(
|
|
|
+ '[media-rotate]',
|
|
|
+ stream.frame,
|
|
|
+ this.rotateframeCnt,
|
|
|
+ stream.clipPath,
|
|
|
+ );
|
|
|
+ // this.logger.log(
|
|
|
+ // `roQueueSubscription:frame:${this.rotateframeCnt} ` +
|
|
|
+ // JSON.stringify(stream.metaData),
|
|
|
+ // );
|
|
|
+
|
|
|
+ const res = await this.streamService.pushFrameToSteam(stream);
|
|
|
+ if (res.done) {
|
|
|
+ clearTimeout(this._rotateTimeout);
|
|
|
+ this._rotateTimeout = setTimeout(() => {
|
|
|
+ console.log('rotate 1秒', Date.now());
|
|
|
+ console.log('rotate end');
|
|
|
+ // const next = res.frame + 1;
|
|
|
+ this.frameCnt.next(res.frame);
|
|
|
+ this.resumeStream();
|
|
|
+ this.rotateframeCnt = -1;
|
|
|
+ this.onMoving.next(false);
|
|
|
+ this.onRotating.next(false);
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
}
|