|
@@ -26,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;
|
|
@@ -59,8 +59,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
private clickQueueSub: any;
|
|
|
|
|
|
private streamServiceSub: any;
|
|
|
- private roRequestQueue: RxQueue = new RxQueue(8);
|
|
|
- private roQueue: RxQueue = new DelayQueue(20);
|
|
|
+ private roRequestQueue: RxQueue = new DelayQueue(20);
|
|
|
+ private roQueue: RxQueue = new DelayQueue(10);
|
|
|
private clickQueue: RxQueue = new DebounceQueue(500);
|
|
|
private moveQueue: RxQueue = new DelayQueue(20);
|
|
|
private joystickQueue: RxQueue = new DebounceQueue(500);
|
|
@@ -283,7 +283,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.holdSteam();
|
|
|
this.lastRenderMedia = src;
|
|
|
const clipPath = this.configService.get('app.prefix') + src;
|
|
|
- delete redisMeta.mediaSrc;
|
|
|
+ //TODO 临时开出
|
|
|
+ // delete redisMeta.mediaSrc;
|
|
|
|
|
|
const random_boolean = Math.random() < 0.3;
|
|
|
|
|
@@ -296,10 +297,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.frameCnt.getValue() < 10
|
|
|
? 3
|
|
|
: random_boolean
|
|
|
- ? 1
|
|
|
- : 3,
|
|
|
+ ? 1
|
|
|
+ : 3,
|
|
|
};
|
|
|
- console.log('rotate', stream, Date.now());
|
|
|
+ // console.log('rotate', stream, Date.now());
|
|
|
clearTimeout(this._rotateTimeout);
|
|
|
this.roQueue.next(stream);
|
|
|
} else {
|
|
@@ -359,8 +360,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (rotateCamData?.length || seqs?.length) {
|
|
|
const lastSeq = rotateCamData?.length
|
|
|
? (Array.from(rotateCamData).concat(
|
|
|
- seqs,
|
|
|
- ) as any as StreamReplyType[])
|
|
|
+ seqs,
|
|
|
+ ) as any as StreamReplyType[])
|
|
|
: seqs;
|
|
|
|
|
|
console.log('walking --总序列--seqs-2', seqs.length);
|
|
@@ -410,8 +411,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
console.log('joystickRes-seqs', seqs.length);
|
|
|
const lastSeq = rotateCamData?.length
|
|
|
? (Array.from(rotateCamData).concat(
|
|
|
- seqs,
|
|
|
- ) as any as StreamReplyType[])
|
|
|
+ seqs,
|
|
|
+ ) as any as StreamReplyType[])
|
|
|
: seqs;
|
|
|
this.handleSeqMoving(lastSeq);
|
|
|
} else {
|
|
@@ -450,7 +451,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const type = frame.type?.length ? frame.type.slice() : 'move';
|
|
|
|
|
|
console.log('type', frame.type);
|
|
|
- delete frame.mediaSrc;
|
|
|
+ // delete frame.mediaSrc;
|
|
|
delete frame.type;
|
|
|
//TODO
|
|
|
const random_boolean = Math.random() < 0.3;
|
|
@@ -627,11 +628,11 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
|
|
|
handleBreath(request) {
|
|
|
const npsRes = this.moveService.getBreakPoints(request);
|
|
|
- console.log('npsRes', npsRes);
|
|
|
+ console.log('npsRes', npsRes.nps.length);
|
|
|
this.streamService.pushNormalDataToStream(npsRes);
|
|
|
}
|
|
|
|
|
|
- updateStatus() {
|
|
|
+ updateStatus(): void {
|
|
|
const reply = {
|
|
|
data: { action_type: 1009, echo_msg: { echoMsg: Date.now() } },
|
|
|
track: false,
|
|
@@ -694,7 +695,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,
|
|
@@ -773,12 +774,16 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
clearTimeout(this._rotateTimeout);
|
|
|
this._rotateTimeout = setTimeout(() => {
|
|
|
console.log('rotate end', Date.now());
|
|
|
- // const next = res.frame + 1;
|
|
|
this.frameCnt.next(res.frame);
|
|
|
this.resumeStream();
|
|
|
this.rotateframeCnt = -1;
|
|
|
this.onMoving.next(false);
|
|
|
this.onRotating.next(false);
|
|
|
+ //TODO rotate完后清除request队列
|
|
|
+ if (this.roRequestQueueSub) {
|
|
|
+ this.roRequestQueueSub.unsubscribe();
|
|
|
+ this.roRequestQueueSub = null;
|
|
|
+ }
|
|
|
}, 300);
|
|
|
}
|
|
|
},
|