|
@@ -45,7 +45,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
private moveService: MoveService,
|
|
private moveService: MoveService,
|
|
private getRouterService: GetRouterService,
|
|
private getRouterService: GetRouterService,
|
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
|
@Inject(WINSTON_MODULE_PROVIDER) private readonly logger: Logger,
|
|
- ) { }
|
|
|
|
|
|
+ ) {}
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
@Client(grpcClientOptions) private readonly client: ClientGrpc;
|
|
|
|
|
|
public _frameInteval: NodeJS.Timeout;
|
|
public _frameInteval: NodeJS.Timeout;
|
|
@@ -311,7 +311,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const rounded = Number(inMillSeconds).toFixed(3);
|
|
const rounded = Number(inMillSeconds).toFixed(3);
|
|
this.logger.info(
|
|
this.logger.info(
|
|
`[timer]-rotate-入队列前: ${rounded}ms -->` +
|
|
`[timer]-rotate-入队列前: ${rounded}ms -->` +
|
|
- JSON.stringify(stream),
|
|
|
|
|
|
+ JSON.stringify(stream),
|
|
);
|
|
);
|
|
if (!this.stopRotated) {
|
|
if (!this.stopRotated) {
|
|
await this.seqExehandleRotateStream(stream);
|
|
await this.seqExehandleRotateStream(stream);
|
|
@@ -508,16 +508,16 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const playerAngle = newUserStates.playerState.player.angle;
|
|
const playerAngle = newUserStates.playerState.player.angle;
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'stop-data-0' +
|
|
'stop-data-0' +
|
|
- 'trace_id: ' +
|
|
|
|
- trace_id +
|
|
|
|
- 'userId:' +
|
|
|
|
- userId +
|
|
|
|
- 'breakPointId :' +
|
|
|
|
- breakPointId +
|
|
|
|
- 'cameraAngle :' +
|
|
|
|
- JSON.stringify(cameraAngle) +
|
|
|
|
- 'playerAngle: ' +
|
|
|
|
- JSON.stringify(playerAngle),
|
|
|
|
|
|
+ 'trace_id: ' +
|
|
|
|
+ trace_id +
|
|
|
|
+ 'userId:' +
|
|
|
|
+ userId +
|
|
|
|
+ 'breakPointId :' +
|
|
|
|
+ breakPointId +
|
|
|
|
+ 'cameraAngle :' +
|
|
|
|
+ JSON.stringify(cameraAngle) +
|
|
|
|
+ 'playerAngle: ' +
|
|
|
|
+ JSON.stringify(playerAngle),
|
|
);
|
|
);
|
|
//debugger;
|
|
//debugger;
|
|
console.log('moveService.stop-1:' + breakPointId);
|
|
console.log('moveService.stop-1:' + breakPointId);
|
|
@@ -563,15 +563,20 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
async getSimplestCameraInfo(appId, userId) {
|
|
async getSimplestCameraInfo(appId, userId) {
|
|
if (this.moveService.cameraInfos.length > 20) {
|
|
if (this.moveService.cameraInfos.length > 20) {
|
|
- const startBreakPointId = this.moveService.cameraInfos[0].startBreakPointId;
|
|
|
|
- const endBreakPointId = this.moveService.cameraInfos[this.moveService.cameraInfos.length - 1].endBreakPointId;
|
|
|
|
-
|
|
|
|
- const path = this.getRouterService.searchRoad2(startBreakPointId, endBreakPointId);
|
|
|
|
|
|
+ const startBreakPointId =
|
|
|
|
+ this.moveService.cameraInfos[0].startBreakPointId;
|
|
|
|
+ const endBreakPointId =
|
|
|
|
+ this.moveService.cameraInfos[this.moveService.cameraInfos.length - 1]
|
|
|
|
+ .endBreakPointId;
|
|
|
|
+
|
|
|
|
+ const path = this.getRouterService.searchRoad2(
|
|
|
|
+ startBreakPointId,
|
|
|
|
+ endBreakPointId,
|
|
|
|
+ );
|
|
if (path == null) {
|
|
if (path == null) {
|
|
//可以清空cameraInfos
|
|
//可以清空cameraInfos
|
|
this.moveService.cameraInfos = [];
|
|
this.moveService.cameraInfos = [];
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
await this.moveService.updateCameraInfoForDely(appId, userId, path);
|
|
await this.moveService.updateCameraInfoForDely(appId, userId, path);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -697,15 +702,15 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
console.log('进入1 - searchRoad');
|
|
console.log('进入1 - searchRoad');
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'handleWalking-users' +
|
|
'handleWalking-users' +
|
|
- JSON.stringify(this.moveService.users) +
|
|
|
|
- ' this.user_id: ' +
|
|
|
|
- this.user_id,
|
|
|
|
|
|
+ JSON.stringify(this.moveService.users) +
|
|
|
|
+ ' this.user_id: ' +
|
|
|
|
+ this.user_id,
|
|
);
|
|
);
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'handleWalking-currentUser' +
|
|
'handleWalking-currentUser' +
|
|
- JSON.stringify(user) +
|
|
|
|
- ' this.user_id: ' +
|
|
|
|
- this.user_id,
|
|
|
|
|
|
+ JSON.stringify(user) +
|
|
|
|
+ ' this.user_id: ' +
|
|
|
|
+ this.user_id,
|
|
);
|
|
);
|
|
console.log('path-start' + user.breakPointId);
|
|
console.log('path-start' + user.breakPointId);
|
|
|
|
|
|
@@ -737,7 +742,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
(item: StreamReplyType, index: number) => {
|
|
(item: StreamReplyType, index: number) => {
|
|
console.log(
|
|
console.log(
|
|
'20220628test:handleWalking->' +
|
|
'20220628test:handleWalking->' +
|
|
- item['newUserStates'][0].renderInfo.isMoving,
|
|
|
|
|
|
+ item['newUserStates'][0].renderInfo.isMoving,
|
|
);
|
|
);
|
|
//const IDRflag = index % 5 === 0 ? 1 : 3;
|
|
//const IDRflag = index % 5 === 0 ? 1 : 3;
|
|
const IDRflag = item.isIDR ? 1 : 3;
|
|
const IDRflag = item.isIDR ? 1 : 3;
|
|
@@ -764,16 +769,16 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
if (seqs?.length) {
|
|
if (seqs?.length) {
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'walking --队列总览:' +
|
|
'walking --队列总览:' +
|
|
- ' 总段数: ' +
|
|
|
|
- walkingRes.length +
|
|
|
|
- ' 镜头帧数:' +
|
|
|
|
- walkingRes[0].length +
|
|
|
|
- ' 行走段数:' +
|
|
|
|
- (walkingRes[0]?.length
|
|
|
|
- ? walkingRes.length - 1
|
|
|
|
- : walkingRes.length) +
|
|
|
|
- ' 队列总帧数:' +
|
|
|
|
- seqs.length,
|
|
|
|
|
|
+ ' 总段数: ' +
|
|
|
|
+ walkingRes.length +
|
|
|
|
+ ' 镜头帧数:' +
|
|
|
|
+ walkingRes[0].length +
|
|
|
|
+ ' 行走段数:' +
|
|
|
|
+ (walkingRes[0]?.length
|
|
|
|
+ ? walkingRes.length - 1
|
|
|
|
+ : walkingRes.length) +
|
|
|
|
+ ' 队列总帧数:' +
|
|
|
|
+ seqs.length,
|
|
);
|
|
);
|
|
const stop = performance.now();
|
|
const stop = performance.now();
|
|
const inMillSeconds = stop - start;
|
|
const inMillSeconds = stop - start;
|
|
@@ -812,7 +817,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
*/
|
|
*/
|
|
async joystick(request: JoystickRequest) {
|
|
async joystick(request: JoystickRequest) {
|
|
// TODO hasJoystickMoveRequest中断
|
|
// TODO hasJoystickMoveRequest中断
|
|
- this.logger.info('this.hasJoystickMoveRequest', this.hasJoystickMoveRequest);
|
|
|
|
|
|
+ this.logger.info(
|
|
|
|
+ 'this.hasJoystickMoveRequest',
|
|
|
|
+ this.hasJoystickMoveRequest,
|
|
|
|
+ );
|
|
if (!this.hasJoystickMoveRequest) {
|
|
if (!this.hasJoystickMoveRequest) {
|
|
this.handlejoystick(request);
|
|
this.handlejoystick(request);
|
|
}
|
|
}
|
|
@@ -831,7 +839,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
//console.log('joystickRes有mediaSrc', joystickRes.mediaSrc);
|
|
//console.log('joystickRes有mediaSrc', joystickRes.mediaSrc);
|
|
console.log(
|
|
console.log(
|
|
'handlejoystick-angle->相机角度-------------------------:' +
|
|
'handlejoystick-angle->相机角度-------------------------:' +
|
|
- joystickRes['newUserStates'][0].playerState.camera.angle.yaw,
|
|
|
|
|
|
+ joystickRes['newUserStates'][0].playerState.camera.angle.yaw,
|
|
);
|
|
);
|
|
let streamData: StreamFrameType | StreamMetaType;
|
|
let streamData: StreamFrameType | StreamMetaType;
|
|
|
|
|
|
@@ -853,11 +861,11 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
};
|
|
};
|
|
console.log(
|
|
console.log(
|
|
'handlejoystick-hasMedia->-------------------------:' +
|
|
'handlejoystick-hasMedia->-------------------------:' +
|
|
- ' frame: ' +
|
|
|
|
- streamData.frame +
|
|
|
|
- mediaSrc +
|
|
|
|
- ' IDR :' +
|
|
|
|
- setDIR,
|
|
|
|
|
|
+ ' frame: ' +
|
|
|
|
+ streamData.frame +
|
|
|
|
+ mediaSrc +
|
|
|
|
+ ' IDR :' +
|
|
|
|
+ setDIR,
|
|
);
|
|
);
|
|
} else {
|
|
} else {
|
|
streamData = {
|
|
streamData = {
|
|
@@ -876,8 +884,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const hasPush = hasMedia
|
|
const hasPush = hasMedia
|
|
? await this.streamService.pushFrameToSteam(streamData as StreamFrameType)
|
|
? await this.streamService.pushFrameToSteam(streamData as StreamFrameType)
|
|
: await this.streamService.pushMetaDataToSteam(
|
|
: await this.streamService.pushMetaDataToSteam(
|
|
- streamData as StreamMetaType,
|
|
|
|
- );
|
|
|
|
|
|
+ streamData as StreamMetaType,
|
|
|
|
+ );
|
|
|
|
|
|
if (hasPush.done) {
|
|
if (hasPush.done) {
|
|
this.isJoystickHasStream = true;
|
|
this.isJoystickHasStream = true;
|
|
@@ -914,9 +922,9 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
if (complementFrame) {
|
|
if (complementFrame) {
|
|
console.log(
|
|
console.log(
|
|
'20220627test-complementFrame 进行' +
|
|
'20220627test-complementFrame 进行' +
|
|
- complementFrame.mediaSrc +
|
|
|
|
- '***' +
|
|
|
|
- this.frameCnt.value,
|
|
|
|
|
|
+ complementFrame.mediaSrc +
|
|
|
|
+ '***' +
|
|
|
|
+ this.frameCnt.value,
|
|
);
|
|
);
|
|
// 第二次或N次进入时如果有值直接重新进入流主程
|
|
// 第二次或N次进入时如果有值直接重新进入流主程
|
|
this.holdSteam();
|
|
this.holdSteam();
|
|
@@ -991,7 +999,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'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.info('joystickRes', JSON.stringify(joystickRes));
|
|
//this.logger.info('joystickRes', JSON.stringify(joystickRes));
|
|
@@ -1076,14 +1084,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
};
|
|
};
|
|
this.logger.info(
|
|
this.logger.info(
|
|
'[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.info(
|
|
this.logger.info(
|
|
@@ -1181,6 +1189,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
this.peer = peer;
|
|
this.peer = peer;
|
|
this.streamService.setChannel(channel);
|
|
this.streamService.setChannel(channel);
|
|
this.startSteaming.next(true);
|
|
this.startSteaming.next(true);
|
|
|
|
+
|
|
// this.startStream();
|
|
// this.startStream();
|
|
// this.handleStream();
|
|
// this.handleStream();
|
|
//TODO 正式channel打开记录,记录多少人在线
|
|
//TODO 正式channel打开记录,记录多少人在线
|
|
@@ -1356,16 +1365,16 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
this.logger.info('frame: ' + frame);
|
|
this.logger.info('frame: ' + frame);
|
|
console.log(
|
|
console.log(
|
|
'networkState:::--->' +
|
|
'networkState:::--->' +
|
|
- ' maxMessageSize: ' +
|
|
|
|
- this.channel.maxMessageSize() +
|
|
|
|
- ' bytesReceived: ' +
|
|
|
|
- this.peer.bytesReceived() +
|
|
|
|
- ' bytesSent: ' +
|
|
|
|
- this.peer.bytesSent() +
|
|
|
|
- ' rtt: ' +
|
|
|
|
- this.peer.rtt() +
|
|
|
|
- ' state: ' +
|
|
|
|
- this.peer.state(),
|
|
|
|
|
|
+ ' maxMessageSize: ' +
|
|
|
|
+ this.channel.maxMessageSize() +
|
|
|
|
+ ' bytesReceived: ' +
|
|
|
|
+ this.peer.bytesReceived() +
|
|
|
|
+ ' bytesSent: ' +
|
|
|
|
+ this.peer.bytesSent() +
|
|
|
|
+ ' rtt: ' +
|
|
|
|
+ this.peer.rtt() +
|
|
|
|
+ ' state: ' +
|
|
|
|
+ this.peer.state(),
|
|
);
|
|
);
|
|
if (frame === 1) {
|
|
if (frame === 1) {
|
|
// redisData = await this.rotateService.echo(this.user_id, true);
|
|
// redisData = await this.rotateService.echo(this.user_id, true);
|
|
@@ -1375,7 +1384,9 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
app_id,
|
|
app_id,
|
|
this.user_id,
|
|
this.user_id,
|
|
);
|
|
);
|
|
- this.logger.info('获取-首屏', redisData);
|
|
|
|
|
|
+ this.logger.warn(
|
|
|
|
+ 'bootstrap:socket::首屏 --->' + JSON.stringify(redisData),
|
|
|
|
+ );
|
|
this.onSteaming = true;
|
|
this.onSteaming = true;
|
|
this.holdSteam();
|
|
this.holdSteam();
|
|
if (redisData && 'mediaSrc' in redisData) {
|
|
if (redisData && 'mediaSrc' in redisData) {
|
|
@@ -1386,7 +1397,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
delete redisData.mediaSrc;
|
|
delete redisData.mediaSrc;
|
|
this.logger.info(
|
|
this.logger.info(
|
|
`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,
|
|
@@ -1415,17 +1426,17 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
console.log(
|
|
console.log(
|
|
'空白流条件-->:' +
|
|
'空白流条件-->:' +
|
|
- isOk +
|
|
|
|
- ' onMoving: ' +
|
|
|
|
- this.onMoving.value +
|
|
|
|
- ' onRotating: ' +
|
|
|
|
- this.onRotating.value +
|
|
|
|
- ' onJoysticking: ' +
|
|
|
|
- this.onJoysticking.value +
|
|
|
|
- ' onSteaming: ' +
|
|
|
|
- this.onSteaming +
|
|
|
|
- ' firstRender: ' +
|
|
|
|
- this.firstRender,
|
|
|
|
|
|
+ isOk +
|
|
|
|
+ ' onMoving: ' +
|
|
|
|
+ this.onMoving.value +
|
|
|
|
+ ' onRotating: ' +
|
|
|
|
+ this.onRotating.value +
|
|
|
|
+ ' onJoysticking: ' +
|
|
|
|
+ this.onJoysticking.value +
|
|
|
|
+ ' onSteaming: ' +
|
|
|
|
+ this.onSteaming +
|
|
|
|
+ ' firstRender: ' +
|
|
|
|
+ this.firstRender,
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|