|
@@ -25,7 +25,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;
|
|
@@ -267,6 +267,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const metaData: StreamReplyType = JSON.parse(
|
|
const metaData: StreamReplyType = JSON.parse(
|
|
lastStreamFrame.metaData,
|
|
lastStreamFrame.metaData,
|
|
) as any as StreamReplyType;
|
|
) as any as StreamReplyType;
|
|
|
|
+
|
|
|
|
+ //判断request是否是新的
|
|
|
|
+ if (metaData.traceIds.indexOf(request.trace_id) > -1) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
const newUserStates: NewUserStatesType = metaData.newUserStates.find(
|
|
const newUserStates: NewUserStatesType = metaData.newUserStates.find(
|
|
(item) => item.userId === this.user_id,
|
|
(item) => item.userId === this.user_id,
|
|
);
|
|
);
|
|
@@ -443,7 +449,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
}
|
|
}
|
|
|
|
|
|
// 二维数组 做move 序列, move类型
|
|
// 二维数组 做move 序列, move类型
|
|
- console.log('move-walkingRes:'+JSON.stringify(walkingRes));
|
|
|
|
|
|
+ console.log('move-walkingRes:' + JSON.stringify(walkingRes));
|
|
if (walkingRes && walkingRes?.length >= 1) {
|
|
if (walkingRes && walkingRes?.length >= 1) {
|
|
for (let i = 1; i < walkingRes.length; i++) {
|
|
for (let i = 1; i < walkingRes.length; i++) {
|
|
Array.from(walkingRes[i]).forEach(
|
|
Array.from(walkingRes[i]).forEach(
|
|
@@ -470,7 +476,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const seqs = Array.from(walkingRes).flat() as any as StreamReplyType[];
|
|
const seqs = Array.from(walkingRes).flat() as any as StreamReplyType[];
|
|
|
|
|
|
if (seqs?.length) {
|
|
if (seqs?.length) {
|
|
- this.logger.log('walking --总序列--seqs-2:'+ seqs.length);
|
|
|
|
|
|
+ this.logger.log('walking --总序列--seqs-2:' + seqs.length);
|
|
const stop = performance.now();
|
|
const stop = performance.now();
|
|
const inMillSeconds = stop - start;
|
|
const inMillSeconds = stop - start;
|
|
const rounded = Number(inMillSeconds).toFixed(3);
|
|
const rounded = Number(inMillSeconds).toFixed(3);
|
|
@@ -523,7 +529,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);
|
|
@@ -685,14 +691,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(
|
|
@@ -771,7 +777,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
const msg: RTCMessageRequest = JSON.parse(message);
|
|
const msg: RTCMessageRequest = JSON.parse(message);
|
|
- console.log('msg.action_type:'+msg.action_type);
|
|
|
|
|
|
+ console.log('msg.action_type:' + msg.action_type);
|
|
switch (msg.action_type) {
|
|
switch (msg.action_type) {
|
|
case ActionType.walk:
|
|
case ActionType.walk:
|
|
const walk = msg as any as MoveRequest;
|
|
const walk = msg as any as MoveRequest;
|
|
@@ -872,8 +878,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;
|
|
@@ -884,12 +889,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(
|
|
@@ -960,7 +965,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,
|