|
@@ -251,7 +251,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// // debugger;
|
|
|
// }
|
|
|
this.handleRotate(request);
|
|
|
- // this._rotateCount += 1;
|
|
|
+ this._rotateCount += 1;
|
|
|
}
|
|
|
/**
|
|
|
* rotate请求队列
|
|
@@ -262,8 +262,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
const rotateUnlock = this.firstRender && !this.globalOptLock;
|
|
|
console.log('rotateUnlock条件--->' + rotateUnlock, this.globalOptLock);
|
|
|
|
|
|
- if (rotateUnlock) {
|
|
|
- //console.log('20220627test:handleRotate')
|
|
|
+ if (rotateUnlock && this._rotateCount > 2) {
|
|
|
+ console.log('20220627test:handleRotate');
|
|
|
const start = performance.now();
|
|
|
// 当move时处理 _rotateCount是移动端同时触发的问题,rotateStopThrottle是减少重复抖动stop的处理。
|
|
|
this.holdSteam();
|
|
@@ -365,6 +365,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.logger.log('rotate end', Date.now());
|
|
|
this.rotateframeCnt = -1;
|
|
|
this._rotateCountFame = -1;
|
|
|
+ this._rotateCount = 0;
|
|
|
this.latestRotateRequest = null;
|
|
|
this.rotateFirstIDR = true;
|
|
|
this.resumeStream();
|
|
@@ -455,7 +456,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
*/
|
|
|
async handleRotateOrWalkingStop(request): Promise<boolean> {
|
|
|
this.rotateStopThrottle = true;
|
|
|
- this.isStopJointing = true
|
|
|
+ this.isStopJointing = true;
|
|
|
const lastStreamFrame = this.lastMoveStreamFrame.getValue();
|
|
|
this.logger.log(
|
|
|
'handleRotateOrWalkingStop-frame',
|
|
@@ -523,7 +524,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
if (hasPush.done) {
|
|
|
//console.log('20220627test:handleRotateOrWalkingStop-stop:'+streamData.clipPath+'**'+streamData.frame);
|
|
|
this.frameCnt.next(hasPush.frame);
|
|
|
- this.isStopJointing = false
|
|
|
+ this.isStopJointing = false;
|
|
|
// this.onMoving.next(false);
|
|
|
// this.cleanMoveSteam();
|
|
|
return Promise.resolve(true);
|
|
@@ -823,11 +824,11 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
* joystick 二合一推流
|
|
|
* @param joystickRes StreamMetaType | StreamFrameType;
|
|
|
*/
|
|
|
- handlePushJoyStickSteamSeq = seqExeAsyncFn(this.handlePushJoyStickSteam)
|
|
|
+ handlePushJoyStickSteamSeq = seqExeAsyncFn(this.handlePushJoyStickSteam);
|
|
|
|
|
|
async handlePushJoyStickSteam(joystickRes: StreamReplyType) {
|
|
|
this.holdSteam();
|
|
|
- this.globalOptLock = true
|
|
|
+ this.globalOptLock = true;
|
|
|
|
|
|
//console.log('joystickRes有mediaSrc', joystickRes.mediaSrc);
|
|
|
console.log(
|
|
@@ -836,10 +837,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
);
|
|
|
let streamData: StreamFrameType | StreamMetaType;
|
|
|
|
|
|
- // if (this.joystickFrameCnt === -1) {
|
|
|
this.joystickFrameCnt = this.frameCnt.getValue() + 1;
|
|
|
- // }
|
|
|
- // this.joystickFrameCnt += 1;
|
|
|
+
|
|
|
const hasMedia = joystickRes?.mediaSrc && joystickRes?.mediaSrc.length > 0;
|
|
|
|
|
|
if (hasMedia) {
|
|
@@ -854,7 +853,14 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
serverTime: this.mockserverTime,
|
|
|
DIR: setDIR,
|
|
|
};
|
|
|
-
|
|
|
+ console.log(
|
|
|
+ 'handlejoystick-hasMedia->-------------------------:' +
|
|
|
+ ' frame: ' +
|
|
|
+ streamData.frame +
|
|
|
+ mediaSrc +
|
|
|
+ ' IDR :' +
|
|
|
+ setDIR,
|
|
|
+ );
|
|
|
} else {
|
|
|
streamData = {
|
|
|
frame: this.joystickFrameCnt,
|
|
@@ -862,7 +868,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- console.log('20220627test-complementFrame 进行1' + '***' + streamData.frame+','+JSON.parse(streamData.metaData).mediaSrc+','+this.moveService.cameraInfos.length);
|
|
|
+ console.log(
|
|
|
+ '20220627test-complementFrame 进行1' + '***' + streamData.frame,
|
|
|
+ );
|
|
|
+
|
|
|
// 过滤新东西, 推完给回false
|
|
|
this.moveService.sendingFrameForJoystick = true;
|
|
|
|
|
@@ -878,6 +887,8 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// if (this.isJoystickHasStream) {
|
|
|
// await this.sleep(20);
|
|
|
// }
|
|
|
+ await this.sleep(20);
|
|
|
+ this.frameCnt.next(hasPush.frame);
|
|
|
this.moveService.sendingFrameForJoystick = false;
|
|
|
const data = joystickRes as StreamReplyType;
|
|
|
console.log('handlejoystick-isIDR:' + data.isIDR);
|
|
@@ -890,7 +901,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// //const lastReply = JSON.stringify(joystickRes);
|
|
|
// //this.moveService.updateUser(userId, breakPointId, lastReply);
|
|
|
// }
|
|
|
- this.frameCnt.next(hasPush.frame);
|
|
|
+
|
|
|
/**
|
|
|
* 这个complementFrame 具体说明 pools 是complementFrame这个返回值
|
|
|
* 1. 第一次要在200ms后调用, 如有值(pools) 就要返回主流程执行,但设置hasJoystickFocusRepeat为true
|
|
@@ -903,18 +914,24 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
this.user_id,
|
|
|
) as StreamReplyType;
|
|
|
if (complementFrame) {
|
|
|
- console.log('20220627test-complementFrame 进行' + complementFrame.mediaSrc + '***' + this.frameCnt.value);
|
|
|
+ console.log(
|
|
|
+ '20220627test-complementFrame 进行' +
|
|
|
+ complementFrame.mediaSrc +
|
|
|
+ '***' +
|
|
|
+ this.frameCnt.value,
|
|
|
+ );
|
|
|
// 第二次或N次进入时如果有值直接重新进入流主程
|
|
|
+ this.holdSteam();
|
|
|
this.handlePushJoyStickSteamSeq(complementFrame);
|
|
|
this.globalOptLock = true;
|
|
|
} else {
|
|
|
console.log('20220627test-complementFrame 结束');
|
|
|
// 第二次或N次无pool数据再次trigger handleJoystickStop
|
|
|
- console.log('gemer-test-complementFrame-空2');
|
|
|
this.hasJoystickFocusRepeat = false;
|
|
|
this.testTimer = 0;
|
|
|
//this.handleJoystickStop(hasPush);
|
|
|
this.globalOptLock = false;
|
|
|
+ this.resumeStream();
|
|
|
}
|
|
|
} else {
|
|
|
this.handleJoystickStop(hasPush);
|
|
@@ -990,11 +1007,12 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// ),
|
|
|
// );
|
|
|
if (!this.onMoving.getValue()) {
|
|
|
+ console.log('handlejoystick:data', JSON.stringify(joystickRes));
|
|
|
this.handlePushJoyStickSteamSeq(joystickRes);
|
|
|
}
|
|
|
} else {
|
|
|
console.log('handlejoystick:null');
|
|
|
- // this.onJoysticking.next(false);
|
|
|
+ this.onJoysticking.next(false);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error('joystick错误', error);
|
|
@@ -1085,7 +1103,7 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// this.logger.log('path-update-index', isLastFrameIndex);
|
|
|
|
|
|
if (res.done) {
|
|
|
- this.frameCnt.next(res.frame)
|
|
|
+ this.frameCnt.next(res.frame);
|
|
|
//关节点入库
|
|
|
if (isLastFrameIndex > -1) {
|
|
|
//this.logger.log('path-update-array', this.lastMovingPointArray);
|
|
@@ -1158,7 +1176,10 @@ export class SceneService implements OnModuleInit, OnModuleDestroy {
|
|
|
// this.startStream();
|
|
|
// this.handleStream();
|
|
|
this.channel.onBufferedAmountLow(() => {
|
|
|
- console.log('onBufferedAmountLow');
|
|
|
+ console.error('onBufferedAmountLow', this.channel.bufferedAmount());
|
|
|
+ //64k->65536 128k->131072
|
|
|
+ this.channel.setBufferedAmountLowThreshold(65536);
|
|
|
+ this.logger.error('onBufferedAmountLow', this.channel.bufferedAmount());
|
|
|
});
|
|
|
}
|
|
|
|