|
@@ -16,7 +16,6 @@ import { DelayQueue, RxQueue, DebounceQueue } from '../queue/mod';
|
|
|
import { MoveService } from 'src/move/move.service';
|
|
|
import { GetRouterService } from 'src/get-router/get-router.service';
|
|
|
import { ConfigService } from '@nestjs/config';
|
|
|
-import { join } from 'path';
|
|
|
|
|
|
@Injectable()
|
|
|
export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
@@ -27,7 +26,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;
|
|
@@ -96,6 +95,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
clipPath: '',
|
|
|
metaData: '',
|
|
|
});
|
|
|
+ public lastMoveStreamFrameBk: StreamFrameType = {
|
|
|
+ frame: -1,
|
|
|
+ clipPath: '',
|
|
|
+ metaData: '',
|
|
|
+ };
|
|
|
+
|
|
|
public users = {};
|
|
|
|
|
|
// initUsers(app_id, userId) {
|
|
@@ -289,6 +294,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// 当move时处理 _rotateCount是移动端同时触发的问题
|
|
|
if (this.onMoving.value && this._rotateCount > 5) {
|
|
|
const lastStreamFrame = this.lastMoveStreamFrame.getValue();
|
|
|
+ const lastMoveStreamFrameBk = this.lastMoveStreamFrameBk;
|
|
|
const metaData: StreamReplyType = JSON.parse(
|
|
|
lastStreamFrame.metaData,
|
|
|
) as any as StreamReplyType;
|
|
@@ -568,7 +574,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const joystickRes = await this.moveService.seqExeJoystick(request);
|
|
|
this.logger.log(
|
|
|
'joystick-breakPointId:' +
|
|
|
- this.moveService.users[this.user_id].breakPointId,
|
|
|
+ this.moveService.users[this.user_id].breakPointId,
|
|
|
);
|
|
|
// 有数据 [0]是rotate数据,[1-infinity]是walking数据
|
|
|
this.logger.log('joystickRes-1', joystickRes);
|
|
@@ -734,14 +740,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
};
|
|
|
this.logger.log(
|
|
|
'[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,
|
|
|
);
|
|
|
this.logger.log(
|
|
@@ -750,6 +756,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
);
|
|
|
// 记录lastMoveStreamFrame给打断逻辑使用
|
|
|
this.lastMoveStreamFrame.next(streamData);
|
|
|
+ this.lastMoveStreamFrameBk = streamData;
|
|
|
const res = await this.streamService.pushFrameToSteam(streamData);
|
|
|
|
|
|
const isLastFrameIndex = this.lastMovingPointArray.findIndex(
|
|
@@ -926,8 +933,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
const IDRflag = this._rotateCurrentFame % 5 === 0 ? 1 : 3;
|
|
|
this.logger.log(
|
|
|
- `当前rotate ,mainframeCnt:${this.frameCnt.getValue()}, _rotateCurrentFame:${
|
|
|
- this._rotateCurrentFame
|
|
|
+ `当前rotate ,mainframeCnt:${this.frameCnt.getValue()}, _rotateCurrentFame:${this._rotateCurrentFame
|
|
|
} IDRflag:${IDRflag}`,
|
|
|
);
|
|
|
stream.DIR = this.rotateFirstIDR ? 1 : IDRflag;
|
|
@@ -938,12 +944,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
this.logger.log(
|
|
|
'[media-rotate]: ' +
|
|
|
- ', frame: ' +
|
|
|
- stream.frame +
|
|
|
- ', rotateframeCnt: ' +
|
|
|
- this.rotateframeCnt +
|
|
|
- ', clipPath: ' +
|
|
|
- stream.clipPath,
|
|
|
+ ', frame: ' +
|
|
|
+ stream.frame +
|
|
|
+ ', rotateframeCnt: ' +
|
|
|
+ this.rotateframeCnt +
|
|
|
+ ', clipPath: ' +
|
|
|
+ stream.clipPath,
|
|
|
// stream.metaData,
|
|
|
);
|
|
|
// this.logger.log(
|
|
@@ -1014,7 +1020,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,
|