|
@@ -253,82 +253,82 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// this.roRequestQueueSub = this.roRequestQueue.subscribe(
|
|
|
// async (request: RotateRequest) => {
|
|
|
// try {
|
|
|
- if (this.firstRender) {
|
|
|
- if (!this.roQueueSubscription) {
|
|
|
- this.handleRotateStream();
|
|
|
- }
|
|
|
- let redisMeta: StreamReplyType;
|
|
|
- this.onRotating.next(true);
|
|
|
- const start = performance.now();
|
|
|
- // 当move时处理
|
|
|
- if (this.onMoving.value) {
|
|
|
- const lastStreamFrame = this.lastMoveStreamFrame.getValue();
|
|
|
- const metaData: StreamReplyType = JSON.parse(
|
|
|
- lastStreamFrame.metaData,
|
|
|
- ) as any as StreamReplyType;
|
|
|
- const newUserStates: NewUserStatesType = metaData.newUserStates.find(
|
|
|
- (item) => item.userId === this.user_id,
|
|
|
- );
|
|
|
- const trace_id = metaData.traceIds[0];
|
|
|
- const userId = newUserStates.userId;
|
|
|
- const breakPointId = metaData.endBreakPointId;
|
|
|
- const cameraAngle = newUserStates.playerState.camera.angle;
|
|
|
- const playerAngle = newUserStates.playerState.player.angle;
|
|
|
- console.log('stop-data', trace_id, userId, cameraAngle, cameraAngle);
|
|
|
- //debugger;
|
|
|
- redisMeta = await this.moveService.stop(
|
|
|
- trace_id,
|
|
|
- userId,
|
|
|
- breakPointId,
|
|
|
- cameraAngle,
|
|
|
- playerAngle,
|
|
|
- );
|
|
|
- console.log('stop-redisMeta', redisMeta);
|
|
|
- this.onMoving.next(false);
|
|
|
- this.cleanMoveSteam();
|
|
|
- // redisMeta = await this.rotateService.rotate(request);
|
|
|
- } else {
|
|
|
- // 正常rotate
|
|
|
- redisMeta = await this.rotateService.seqExeRotate(request);
|
|
|
- // console.log(redisMeta);
|
|
|
- //debugger;
|
|
|
- }
|
|
|
+ if (this.firstRender) {
|
|
|
+ if (!this.roQueueSubscription) {
|
|
|
+ this.handleRotateStream();
|
|
|
+ }
|
|
|
+ let redisMeta: StreamReplyType;
|
|
|
+ this.onRotating.next(true);
|
|
|
+ const start = performance.now();
|
|
|
+ // 当move时处理
|
|
|
+ if (this.onMoving.value) {
|
|
|
+ const lastStreamFrame = this.lastMoveStreamFrame.getValue();
|
|
|
+ const metaData: StreamReplyType = JSON.parse(
|
|
|
+ lastStreamFrame.metaData,
|
|
|
+ ) as any as StreamReplyType;
|
|
|
+ const newUserStates: NewUserStatesType = metaData.newUserStates.find(
|
|
|
+ (item) => item.userId === this.user_id,
|
|
|
+ );
|
|
|
+ const trace_id = metaData.traceIds[0];
|
|
|
+ const userId = newUserStates.userId;
|
|
|
+ const breakPointId = metaData.endBreakPointId;
|
|
|
+ const cameraAngle = newUserStates.playerState.camera.angle;
|
|
|
+ const playerAngle = newUserStates.playerState.player.angle;
|
|
|
+ console.log('stop-data', trace_id, userId, cameraAngle, cameraAngle);
|
|
|
+ //debugger;
|
|
|
+ redisMeta = await this.moveService.stop(
|
|
|
+ trace_id,
|
|
|
+ userId,
|
|
|
+ breakPointId,
|
|
|
+ cameraAngle,
|
|
|
+ playerAngle,
|
|
|
+ );
|
|
|
+ console.log('stop-redisMeta', redisMeta);
|
|
|
+ this.onMoving.next(false);
|
|
|
+ this.cleanMoveSteam();
|
|
|
+ // redisMeta = await this.rotateService.rotate(request);
|
|
|
+ } else {
|
|
|
+ // 正常rotate
|
|
|
+ redisMeta = await this.rotateService.seqExeRotate(request);
|
|
|
+ // console.log(redisMeta);
|
|
|
+ //debugger;
|
|
|
+ }
|
|
|
|
|
|
- if (redisMeta && 'mediaSrc' in redisMeta) {
|
|
|
- const mediaSrc: string = redisMeta.mediaSrc || '';
|
|
|
- if (mediaSrc.length > 0) {
|
|
|
- const src = mediaSrc.split('?')[0];
|
|
|
- // console.log('进入roQueue1', redisMeta.newUserStates[0].playerState.camera.angle.yaw);
|
|
|
- // console.log('进入roQueue2', src);
|
|
|
- if (src.length > 0) {
|
|
|
- // console.log('不同源');
|
|
|
- this.holdSteam();
|
|
|
- this.lastRenderMedia = src;
|
|
|
- const clipPath = this.configService.get('app.prefix') + src;
|
|
|
- //TODO 临时开出
|
|
|
- // delete redisMeta.mediaSrc;
|
|
|
- const stream: StreamFrameType = {
|
|
|
- frame: -1,
|
|
|
- clipPath: clipPath,
|
|
|
- metaData: JSON.stringify(redisMeta),
|
|
|
- serverTime: this.mockserverTime,
|
|
|
- DIR: 3,
|
|
|
- };
|
|
|
- // console.log('rotate', stream, Date.now());
|
|
|
- clearTimeout(this._rotateTimeout);
|
|
|
-
|
|
|
- // console.log('进入roQueue3', stream.clipPath);
|
|
|
- const stop = performance.now();
|
|
|
- const inMillSeconds = stop - start;
|
|
|
- const rounded = Number(inMillSeconds).toFixed(3);
|
|
|
- console.log(`[timer]-rotate-入队列前: ${rounded}ms`);
|
|
|
- this.roQueue.next(stream);
|
|
|
- } else {
|
|
|
- // this.onRotating.next(false);
|
|
|
- }
|
|
|
+ if (redisMeta && 'mediaSrc' in redisMeta) {
|
|
|
+ const mediaSrc: string = redisMeta.mediaSrc || '';
|
|
|
+ if (mediaSrc.length > 0) {
|
|
|
+ const src = mediaSrc.split('?')[0];
|
|
|
+ // console.log('进入roQueue1', redisMeta.newUserStates[0].playerState.camera.angle.yaw);
|
|
|
+ // console.log('进入roQueue2', src);
|
|
|
+ if (src.length > 0) {
|
|
|
+ // console.log('不同源');
|
|
|
+ this.holdSteam();
|
|
|
+ this.lastRenderMedia = src;
|
|
|
+ const clipPath = this.configService.get('app.prefix') + src;
|
|
|
+ //TODO 临时开出
|
|
|
+ // delete redisMeta.mediaSrc;
|
|
|
+ const stream: StreamFrameType = {
|
|
|
+ frame: -1,
|
|
|
+ clipPath: clipPath,
|
|
|
+ metaData: JSON.stringify(redisMeta),
|
|
|
+ serverTime: this.mockserverTime,
|
|
|
+ DIR: 3,
|
|
|
+ };
|
|
|
+ // console.log('rotate', stream, Date.now());
|
|
|
+ clearTimeout(this._rotateTimeout);
|
|
|
+
|
|
|
+ // console.log('进入roQueue3', stream.clipPath);
|
|
|
+ const stop = performance.now();
|
|
|
+ const inMillSeconds = stop - start;
|
|
|
+ const rounded = Number(inMillSeconds).toFixed(3);
|
|
|
+ console.log(`[timer]-rotate-入队列前: ${rounded}ms`);
|
|
|
+ this.roQueue.next(stream);
|
|
|
+ } else {
|
|
|
+ // this.onRotating.next(false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
// } catch (error) {
|
|
|
// this.logger.error('rotate', error.message);
|
|
|
// console.error('error', error);
|