|
@@ -26,7 +26,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
private rotateService: RotateService,
|
|
private rotateService: RotateService,
|
|
private moveService: MoveService,
|
|
private moveService: MoveService,
|
|
private getRouterService: GetRouterService, // @InjectQueue('rotate') private rotateQueue: Queue, // @InjectQueue('walking') private walkingQueue: Queue,
|
|
private getRouterService: GetRouterService, // @InjectQueue('rotate') private rotateQueue: Queue, // @InjectQueue('walking') private walkingQueue: Queue,
|
|
- ) {}
|
|
|
|
|
|
+ ) { }
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
|
|
|
|
public _frameInteval: NodeJS.Timeout;
|
|
public _frameInteval: NodeJS.Timeout;
|
|
@@ -360,7 +360,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
this.latestWalkingRequest = null;
|
|
this.latestWalkingRequest = null;
|
|
this.handleWalking(request);
|
|
this.handleWalking(request);
|
|
}
|
|
}
|
|
- // 监听每小段最后一zhen
|
|
|
|
|
|
+ //TODO 确保moveSliceLastFrameSub不会重复
|
|
|
|
+ // if (this.moveSliceLastFrameSub) {
|
|
|
|
+ console.log('moveSliceLastFrameSub', this.moveSliceLastFrameSub);
|
|
|
|
+ // this.moveSliceLastFrameSub.unsubscribe();
|
|
|
|
+ // this.moveSliceLastFrameSub = null;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // 监听每小段最后一帧
|
|
if (!this.moveSliceLastFrameSub) {
|
|
if (!this.moveSliceLastFrameSub) {
|
|
this.moveSliceLastFrameSub = this.moveSliceLastFrame.subscribe(
|
|
this.moveSliceLastFrameSub = this.moveSliceLastFrame.subscribe(
|
|
async (frame: MovingLastUpdateType) => {
|
|
async (frame: MovingLastUpdateType) => {
|
|
@@ -368,9 +375,6 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
//TODO 正在行走时,有新的reqest
|
|
//TODO 正在行走时,有新的reqest
|
|
if (this.latestWalkingRequest && this.onMoving.value) {
|
|
if (this.latestWalkingRequest && this.onMoving.value) {
|
|
this.logger.log('stop-data-1', frame);
|
|
this.logger.log('stop-data-1', frame);
|
|
- // this.moveQueue.complete();
|
|
|
|
- // this.moveQueue.of('');
|
|
|
|
- // TODO 中断move队列 ?优化如何清空
|
|
|
|
this.moveQueue.clean();
|
|
this.moveQueue.clean();
|
|
// this.moveQueueSubscription.unsubscribe();
|
|
// this.moveQueueSubscription.unsubscribe();
|
|
// this.moveQueueSubscription = null;
|
|
// this.moveQueueSubscription = null;
|
|
@@ -540,7 +544,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
this.logger.log(
|
|
this.logger.log(
|
|
'joystick-breakPointId:' +
|
|
'joystick-breakPointId:' +
|
|
- this.moveService.users[this.user_id].breakPointId,
|
|
|
|
|
|
+ this.moveService.users[this.user_id].breakPointId,
|
|
);
|
|
);
|
|
// 有数据 [0]是rotate数据,[1-infinity]是walking数据
|
|
// 有数据 [0]是rotate数据,[1-infinity]是walking数据
|
|
this.logger.log('joystickRes-1', joystickRes);
|
|
this.logger.log('joystickRes-1', joystickRes);
|
|
@@ -677,6 +681,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
this.walkingSub.unsubscribe();
|
|
this.walkingSub.unsubscribe();
|
|
this.walkingSub = null;
|
|
this.walkingSub = null;
|
|
}
|
|
}
|
|
|
|
+ if (this.moveSliceLastFrameSub) {
|
|
|
|
+ this.moveSliceLastFrameSub.unsubscribe();
|
|
|
|
+ this.moveSliceLastFrameSub = null;
|
|
|
|
+ }
|
|
// if (this.clickQueueSub) {
|
|
// if (this.clickQueueSub) {
|
|
// this.clickQueueSub.unsubscribe();
|
|
// this.clickQueueSub.unsubscribe();
|
|
// this.clickQueueSub = null;
|
|
// this.clickQueueSub = null;
|
|
@@ -702,14 +710,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
};
|
|
};
|
|
this.logger.log(
|
|
this.logger.log(
|
|
'[media-move]: ' +
|
|
'[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,
|
|
// stream.metaData,
|
|
);
|
|
);
|
|
this.logger.log(
|
|
this.logger.log(
|
|
@@ -889,8 +897,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
const IDRflag = this._rotateCurrentFame % 5 === 0 ? 1 : 3;
|
|
const IDRflag = this._rotateCurrentFame % 5 === 0 ? 1 : 3;
|
|
this.logger.log(
|
|
this.logger.log(
|
|
- `当前rotate ,mainframeCnt:${this.frameCnt.getValue()}, _rotateCurrentFame:${
|
|
|
|
- this._rotateCurrentFame
|
|
|
|
|
|
+ `当前rotate ,mainframeCnt:${this.frameCnt.getValue()}, _rotateCurrentFame:${this._rotateCurrentFame
|
|
} IDRflag:${IDRflag}`,
|
|
} IDRflag:${IDRflag}`,
|
|
);
|
|
);
|
|
stream.DIR = this.rotateFirstIDR ? 1 : IDRflag;
|
|
stream.DIR = this.rotateFirstIDR ? 1 : IDRflag;
|
|
@@ -901,12 +908,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
this.logger.log(
|
|
this.logger.log(
|
|
'[media-rotate]: ' +
|
|
'[media-rotate]: ' +
|
|
- ', frame: ' +
|
|
|
|
- stream.frame +
|
|
|
|
- ', rotateframeCnt: ' +
|
|
|
|
- this.rotateframeCnt +
|
|
|
|
- ', clipPath: ' +
|
|
|
|
- stream.clipPath,
|
|
|
|
|
|
+ ', frame: ' +
|
|
|
|
+ stream.frame +
|
|
|
|
+ ', rotateframeCnt: ' +
|
|
|
|
+ this.rotateframeCnt +
|
|
|
|
+ ', clipPath: ' +
|
|
|
|
+ stream.clipPath,
|
|
// stream.metaData,
|
|
// stream.metaData,
|
|
);
|
|
);
|
|
// this.logger.log(
|
|
// this.logger.log(
|
|
@@ -977,7 +984,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
delete redisData.mediaSrc;
|
|
delete redisData.mediaSrc;
|
|
this.logger.log(
|
|
this.logger.log(
|
|
`user:${this.user_id}:first render stream` +
|
|
`user:${this.user_id}:first render stream` +
|
|
- JSON.stringify({ path: clipPath, meta: redisData }),
|
|
|
|
|
|
+ JSON.stringify({ path: clipPath, meta: redisData }),
|
|
);
|
|
);
|
|
const status = await this.pushFirstRender(
|
|
const status = await this.pushFirstRender(
|
|
clipPath,
|
|
clipPath,
|