|
@@ -58,16 +58,16 @@ export default class Workers {
|
|
(this.bigJankTimes = 0),
|
|
(this.bigJankTimes = 0),
|
|
(this.DecodeJankTimes = 0),
|
|
(this.DecodeJankTimes = 0),
|
|
(this.bigDecodeJankTimes = 0),
|
|
(this.bigDecodeJankTimes = 0),
|
|
- (this.saveframe = !1),
|
|
|
|
- (this.SaveMediaStream = !1),
|
|
|
|
|
|
+ (this.saveframe = false),
|
|
|
|
+ (this.SaveMediaStream = false),
|
|
(this.packetsLost = 0),
|
|
(this.packetsLost = 0),
|
|
- (this.showAllReceivedMetadata = !1),
|
|
|
|
|
|
+ (this.showAllReceivedMetadata = false),
|
|
(this.firstMediaArraval = 0),
|
|
(this.firstMediaArraval = 0),
|
|
- (this.firstMediaReceived = !1),
|
|
|
|
|
|
+ (this.firstMediaReceived = false),
|
|
(this.firstYUVDecoded = 0),
|
|
(this.firstYUVDecoded = 0),
|
|
(this.firstRender = 0),
|
|
(this.firstRender = 0),
|
|
- (this.firstYUVReceived = !1),
|
|
|
|
- (this.reconnectSignal = !1),
|
|
|
|
|
|
+ (this.firstYUVReceived = false),
|
|
|
|
+ (this.reconnectSignal = false),
|
|
(this.serverFrameSlow = 0),
|
|
(this.serverFrameSlow = 0),
|
|
(this.serverFrameFast = 0),
|
|
(this.serverFrameFast = 0),
|
|
(this.clientFrameSlow = 0),
|
|
(this.clientFrameSlow = 0),
|
|
@@ -75,7 +75,7 @@ export default class Workers {
|
|
(this.lastServerTS = 0),
|
|
(this.lastServerTS = 0),
|
|
(this.lastClientTS = 0),
|
|
(this.lastClientTS = 0),
|
|
(this.lastSeq = 0),
|
|
(this.lastSeq = 0),
|
|
- (this.lastIsPureMeta = !1),
|
|
|
|
|
|
+ (this.lastIsPureMeta = false),
|
|
(this.lastHBPacketTs = 0),
|
|
(this.lastHBPacketTs = 0),
|
|
(this.HBPacketInterval = 0),
|
|
(this.HBPacketInterval = 0),
|
|
(this.lastHBPacketSrvSentTs = 0),
|
|
(this.lastHBPacketSrvSentTs = 0),
|
|
@@ -84,22 +84,22 @@ export default class Workers {
|
|
(this.cachedStreams = new Array(this.cachedLength)),
|
|
(this.cachedStreams = new Array(this.cachedLength)),
|
|
(this.cachedMetas = new Array(this.cachedLength)),
|
|
(this.cachedMetas = new Array(this.cachedLength)),
|
|
(this.cachedPtss = new Array(this.cachedLength)),
|
|
(this.cachedPtss = new Array(this.cachedLength)),
|
|
- (this.cachedRender = Array(this.cachedLength).fill(!1)),
|
|
|
|
|
|
+ (this.cachedRender = Array(this.cachedLength).fill(false)),
|
|
(this.cachedResolution = new Array(this.cachedLength)),
|
|
(this.cachedResolution = new Array(this.cachedLength)),
|
|
(this.getPtr = 0),
|
|
(this.getPtr = 0),
|
|
(this.setPtr = 0),
|
|
(this.setPtr = 0),
|
|
(this.receiveIframes = 0),
|
|
(this.receiveIframes = 0),
|
|
(this.decodeIframes = 0),
|
|
(this.decodeIframes = 0),
|
|
(this.prevSenderTs = -1),
|
|
(this.prevSenderTs = -1),
|
|
- (this.serverSendTimeArray = new CircularArray(120, !1, [])),
|
|
|
|
- (this.inPanoMode = !1),
|
|
|
|
|
|
+ (this.serverSendTimeArray = new CircularArray(120, false, [])),
|
|
|
|
+ (this.inPanoMode = false),
|
|
(this.PanoStatus = {
|
|
(this.PanoStatus = {
|
|
x: 0,
|
|
x: 0,
|
|
y: 0,
|
|
y: 0,
|
|
z: 0,
|
|
z: 0,
|
|
tiles: [],
|
|
tiles: [],
|
|
}),
|
|
}),
|
|
- (this.DynamicPanoTest = !1),
|
|
|
|
|
|
+ (this.DynamicPanoTest = false),
|
|
(this.PanoMask = new ArrayBuffer(8)),
|
|
(this.PanoMask = new ArrayBuffer(8)),
|
|
(this.PanoView = new DataView(this.PanoMask)),
|
|
(this.PanoView = new DataView(this.PanoMask)),
|
|
(this.userId_test = ""),
|
|
(this.userId_test = ""),
|
|
@@ -120,15 +120,15 @@ export default class Workers {
|
|
(this.joyStickResponseMiss = 0),
|
|
(this.joyStickResponseMiss = 0),
|
|
(this.joyStickProcessMiss = 0),
|
|
(this.joyStickProcessMiss = 0),
|
|
(this.joyStickDisplayMiss = 0),
|
|
(this.joyStickDisplayMiss = 0),
|
|
- (this.updateYUVCircular = new CircularArray(120, !1, [])),
|
|
|
|
|
|
+ (this.updateYUVCircular = new CircularArray(120, false, [])),
|
|
(this.updateDropFrame = 0),
|
|
(this.updateDropFrame = 0),
|
|
- (this.metaParseAraay = []),
|
|
|
|
|
|
+ (this.metaParseArray = []),
|
|
(this.responseMoveMiss = 0),
|
|
(this.responseMoveMiss = 0),
|
|
(this.processMoveMiss = 0),
|
|
(this.processMoveMiss = 0),
|
|
(this.displayMoveMiss = 0),
|
|
(this.displayMoveMiss = 0),
|
|
(this.MovingTraceId = ""),
|
|
(this.MovingTraceId = ""),
|
|
(this.PendingMovingTraceId = ""),
|
|
(this.PendingMovingTraceId = ""),
|
|
- (this.inMovingMode = !1),
|
|
|
|
|
|
+ (this.inMovingMode = false),
|
|
(this.StartMovingTs = 0),
|
|
(this.StartMovingTs = 0),
|
|
(this.PendingStartMovingTs = 0),
|
|
(this.PendingStartMovingTs = 0),
|
|
(this.moveEvent = ""),
|
|
(this.moveEvent = ""),
|
|
@@ -140,35 +140,39 @@ export default class Workers {
|
|
(this.lastMoveResponseTime = 0),
|
|
(this.lastMoveResponseTime = 0),
|
|
(this.lastMoveProcessTime = 0),
|
|
(this.lastMoveProcessTime = 0),
|
|
(this.lastMoveDisplayTime = 0),
|
|
(this.lastMoveDisplayTime = 0),
|
|
- (this.moveResponseCircular = new CircularArray(120, !0, [
|
|
|
|
|
|
+ (this.moveResponseCircular = new CircularArray(120, true, [
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_BAD,
|
|
STUCK_STAGE_BAD,
|
|
])),
|
|
])),
|
|
- (this.moveProcessCircular = new CircularArray(120, !0, [
|
|
|
|
|
|
+ (this.moveProcessCircular = new CircularArray(120, true, [
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_BAD,
|
|
STUCK_STAGE_BAD,
|
|
])),
|
|
])),
|
|
- (this.moveDisplayCircular = new CircularArray(120, !0, [
|
|
|
|
|
|
+ (this.moveDisplayCircular = new CircularArray(120, true, [
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_GOOD,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_WELL,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_FAIR,
|
|
STUCK_STAGE_BAD,
|
|
STUCK_STAGE_BAD,
|
|
])),
|
|
])),
|
|
(this.moveStartPts = -1),
|
|
(this.moveStartPts = -1),
|
|
- (this.frameServerCircular = new CircularArray(120, !1, [])),
|
|
|
|
- (this.srvMetaIntervalCircular = new CircularArray(120, !1, [])),
|
|
|
|
- (this.srvMediaIntervalCircular = new CircularArray(120, !1, [])),
|
|
|
|
- (this.srvHBMetaIntervalCircular = new CircularArray(120, !1, [])),
|
|
|
|
- (this.srvHBMetaIntervalSrvSentCircular = new CircularArray(120, !1, [])),
|
|
|
|
- (this.frameClientCircular = new CircularArray(120, !1, [])),
|
|
|
|
|
|
+ (this.frameServerCircular = new CircularArray(120, false, [])),
|
|
|
|
+ (this.srvMetaIntervalCircular = new CircularArray(120, false, [])),
|
|
|
|
+ (this.srvMediaIntervalCircular = new CircularArray(120, false, [])),
|
|
|
|
+ (this.srvHBMetaIntervalCircular = new CircularArray(120, false, [])),
|
|
|
|
+ (this.srvHBMetaIntervalSrvSentCircular = new CircularArray(
|
|
|
|
+ 120,
|
|
|
|
+ false,
|
|
|
|
+ []
|
|
|
|
+ )),
|
|
|
|
+ (this.frameClientCircular = new CircularArray(120, false, [])),
|
|
(this.unmarshalStreamExecutionArray = new SecondArray()),
|
|
(this.unmarshalStreamExecutionArray = new SecondArray()),
|
|
(this.receiveYUVExecutionArray = new SecondArray()),
|
|
(this.receiveYUVExecutionArray = new SecondArray()),
|
|
(this.postMessageWaitArray = new SecondArray()),
|
|
(this.postMessageWaitArray = new SecondArray()),
|
|
- (this.firstUpdateYUV = !0),
|
|
|
|
|
|
+ (this.firstUpdateYUV = true),
|
|
(this.functionMap = new Map()),
|
|
(this.functionMap = new Map()),
|
|
(this.WASM_VERSION = "WASM-1.1"),
|
|
(this.WASM_VERSION = "WASM-1.1"),
|
|
(this.frameHistory = []),
|
|
(this.frameHistory = []),
|
|
@@ -303,7 +307,7 @@ export default class Workers {
|
|
o != null && ((o.receiveTime = Date.now()), (o.status = 1));
|
|
o != null && ((o.receiveTime = Date.now()), (o.status = 1));
|
|
}
|
|
}
|
|
if (i == this.PendingMovingTraceId) {
|
|
if (i == this.PendingMovingTraceId) {
|
|
- (this.inMovingMode = !0),
|
|
|
|
|
|
+ (this.inMovingMode = true),
|
|
(this.MovingTraceId = this.PendingMovingTraceId),
|
|
(this.MovingTraceId = this.PendingMovingTraceId),
|
|
(this.StartMovingTs = this.PendingStartMovingTs),
|
|
(this.StartMovingTs = this.PendingStartMovingTs),
|
|
(this.PendingMovingTraceId = ""),
|
|
(this.PendingMovingTraceId = ""),
|
|
@@ -474,10 +478,11 @@ export default class Workers {
|
|
metric: "firstRenderAt",
|
|
metric: "firstRenderAt",
|
|
value: j,
|
|
value: j,
|
|
group: "joinRoom",
|
|
group: "joinRoom",
|
|
- }),
|
|
|
|
- (this.firstYUVReceived = !0),
|
|
|
|
- (this.lastRenderTs = Date.now());
|
|
|
|
|
|
+ });
|
|
|
|
+ this.firstYUVReceived = true;
|
|
|
|
+ this.lastRenderTs = Date.now();
|
|
}
|
|
}
|
|
|
|
+
|
|
if (
|
|
if (
|
|
!this.cachedRender[this.setPtr] &&
|
|
!this.cachedRender[this.setPtr] &&
|
|
this.cachedMetas[this.setPtr] != null
|
|
this.cachedMetas[this.setPtr] != null
|
|
@@ -497,12 +502,16 @@ export default class Workers {
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: this.cachedMetas[this.setPtr],
|
|
signal: this.cachedMetas[this.setPtr],
|
|
pts: this.cachedPtss[this.setPtr],
|
|
pts: this.cachedPtss[this.setPtr],
|
|
- alreadyUpdateYUV: !0,
|
|
|
|
|
|
+ alreadyUpdateYUV: true,
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
this.updateDropFrame += 1;
|
|
this.updateDropFrame += 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //重新decode cache ptr
|
|
|
|
+
|
|
|
|
+ console.log("this.cachedStreams", this.cachedStreams, this.setPtr);
|
|
|
|
+
|
|
this.decoderWorker.postMessage(
|
|
this.decoderWorker.postMessage(
|
|
{
|
|
{
|
|
t: 2,
|
|
t: 2,
|
|
@@ -540,11 +549,12 @@ export default class Workers {
|
|
this.cachedStreams[c] = e.data.data;
|
|
this.cachedStreams[c] = e.data.data;
|
|
this.cachedMetas[c] = e.data.metadata;
|
|
this.cachedMetas[c] = e.data.metadata;
|
|
this.cachedPtss[c] = e.data.pts;
|
|
this.cachedPtss[c] = e.data.pts;
|
|
- this.cachedRender[c] = !1;
|
|
|
|
|
|
+ this.cachedRender[c] = false;
|
|
this.cachedResolution[c] = {
|
|
this.cachedResolution[c] = {
|
|
width: e.data.width,
|
|
width: e.data.width,
|
|
height: e.data.height,
|
|
height: e.data.height,
|
|
};
|
|
};
|
|
|
|
+
|
|
this.setPtr = (this.setPtr + 1) % this.cachedLength;
|
|
this.setPtr = (this.setPtr + 1) % this.cachedLength;
|
|
const _ = Date.now() - i;
|
|
const _ = Date.now() - i;
|
|
this.receiveYUVExecutionArray.add(_);
|
|
this.receiveYUVExecutionArray.add(_);
|
|
@@ -622,20 +632,20 @@ export default class Workers {
|
|
data: e.data.data,
|
|
data: e.data.data,
|
|
metadata: e.data.metadata,
|
|
metadata: e.data.metadata,
|
|
tileId: e.data.tileId,
|
|
tileId: e.data.tileId,
|
|
- finished: !0,
|
|
|
|
|
|
+ finished: true,
|
|
matchAngle: o,
|
|
matchAngle: o,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
enable_decoder_queue_logging() {
|
|
enable_decoder_queue_logging() {
|
|
this.decoderWorker.postMessage({
|
|
this.decoderWorker.postMessage({
|
|
t: 100,
|
|
t: 100,
|
|
- status: !0,
|
|
|
|
|
|
+ status: true,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
disable_decoder_queue_logging() {
|
|
disable_decoder_queue_logging() {
|
|
this.decoderWorker.postMessage({
|
|
this.decoderWorker.postMessage({
|
|
t: 100,
|
|
t: 100,
|
|
- status: !1,
|
|
|
|
|
|
+ status: false,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -707,13 +717,13 @@ export default class Workers {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case 5:
|
|
case 5:
|
|
- console.log(
|
|
|
|
- "接受webrtc请求(来自worker):" + JSON.stringify(s.data.metadata)
|
|
|
|
- );
|
|
|
|
|
|
+ // console.log(
|
|
|
|
+ // "接受webrtc请求(来自worker):" + JSON.stringify(s.data.metadata)
|
|
|
|
+ // );
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: s.data.metadata,
|
|
signal: s.data.metadata,
|
|
pts: -1,
|
|
pts: -1,
|
|
- alreadyUpdateYUV: !1,
|
|
|
|
|
|
+ alreadyUpdateYUV: false,
|
|
});
|
|
});
|
|
break;
|
|
break;
|
|
case 6:
|
|
case 6:
|
|
@@ -776,7 +786,7 @@ export default class Workers {
|
|
value: $,
|
|
value: $,
|
|
group: "joinRoom",
|
|
group: "joinRoom",
|
|
}),
|
|
}),
|
|
- (this.firstUpdateYUV = !1);
|
|
|
|
|
|
+ (this.firstUpdateYUV = false);
|
|
}
|
|
}
|
|
this.cachedStreams[e] != null &&
|
|
this.cachedStreams[e] != null &&
|
|
this.executeFunction("stream", {
|
|
this.executeFunction("stream", {
|
|
@@ -785,6 +795,7 @@ export default class Workers {
|
|
height: this.cachedResolution[e].height,
|
|
height: this.cachedResolution[e].height,
|
|
pts: this.cachedPtss[e],
|
|
pts: this.cachedPtss[e],
|
|
});
|
|
});
|
|
|
|
+
|
|
const c = Date.now();
|
|
const c = Date.now();
|
|
this.cachedStreams[e] != null &&
|
|
this.cachedStreams[e] != null &&
|
|
this.decoderWorker.postMessage(
|
|
this.decoderWorker.postMessage(
|
|
@@ -854,24 +865,32 @@ export default class Workers {
|
|
_e = $ - this.lastMoveDisplayTime;
|
|
_e = $ - this.lastMoveDisplayTime;
|
|
this.moveDisplayCircular.add(_e), (this.lastMoveDisplayTime = $);
|
|
this.moveDisplayCircular.add(_e), (this.lastMoveDisplayTime = $);
|
|
}
|
|
}
|
|
- console.log(
|
|
|
|
- "接受webrtc请求(定时执行UpdateYUV):" +
|
|
|
|
- JSON.stringify(this.cachedMetas[e])
|
|
|
|
- );
|
|
|
|
|
|
+ // console.log(
|
|
|
|
+ // "接受webrtc请求(定时执行UpdateYUV):" +
|
|
|
|
+ // JSON.stringify(this.cachedMetas[e])
|
|
|
|
+ // );
|
|
|
|
+ // console.log('回传',{
|
|
|
|
+ // signal: this.cachedMetas[e],
|
|
|
|
+ // pts: this.cachedPtss[e],
|
|
|
|
+ // alreadyUpdateYUV: true,
|
|
|
|
+ // })
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: this.cachedMetas[e],
|
|
signal: this.cachedMetas[e],
|
|
pts: this.cachedPtss[e],
|
|
pts: this.cachedPtss[e],
|
|
- alreadyUpdateYUV: !0,
|
|
|
|
- }),
|
|
|
|
- (this.cachedRender[e] = !0),
|
|
|
|
- (this.getPtr = (this.getPtr + 1) % this.cachedLength);
|
|
|
|
|
|
+ alreadyUpdateYUV: true,
|
|
|
|
+ });
|
|
|
|
+ this.cachedRender[e] = true;
|
|
|
|
+ this.getPtr = (this.getPtr + 1) % this.cachedLength;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
unmarshalPano(e) {
|
|
unmarshalPano(e) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ unmarshalPanobk(e) {
|
|
const i = new DataView(e),
|
|
const i = new DataView(e),
|
|
o = i.getUint32(0);
|
|
o = i.getUint32(0);
|
|
- if (o == 1723558763) return !0;
|
|
|
|
- if (o != 2296221069) return !1;
|
|
|
|
|
|
+ if (o == 1723558763) return true;
|
|
|
|
+ if (o != 2296221069) return false;
|
|
console.log("Receive Pano Message"), i.getUint16(4);
|
|
console.log("Receive Pano Message"), i.getUint16(4);
|
|
const s = i.getUint16(6),
|
|
const s = i.getUint16(6),
|
|
c = i.getUint32(8),
|
|
c = i.getUint32(8),
|
|
@@ -919,11 +938,11 @@ export default class Workers {
|
|
(this.panoCacheSize = k),
|
|
(this.panoCacheSize = k),
|
|
(this.cachePanoTileID = c);
|
|
(this.cachePanoTileID = c);
|
|
}
|
|
}
|
|
- return !0;
|
|
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
clearMoveArray() {
|
|
clearMoveArray() {
|
|
(this.MovingTraceId = ""),
|
|
(this.MovingTraceId = ""),
|
|
- (this.inMovingMode = !1),
|
|
|
|
|
|
+ (this.inMovingMode = false),
|
|
(this.StartMovingTs = 0),
|
|
(this.StartMovingTs = 0),
|
|
(this.MoveToFrameCnt = 0),
|
|
(this.MoveToFrameCnt = 0),
|
|
(this.MoveResponseDelay = 0),
|
|
(this.MoveResponseDelay = 0),
|
|
@@ -962,25 +981,27 @@ export default class Workers {
|
|
this.serverSendTimeArray.add(i), (this.prevSenderTs = e);
|
|
this.serverSendTimeArray.add(i), (this.prevSenderTs = e);
|
|
}
|
|
}
|
|
// new unmarshalStream
|
|
// new unmarshalStream
|
|
- unmarshalStream(e) {
|
|
|
|
|
|
+ unmarshalStreamBk(e) {
|
|
console.log("e", e);
|
|
console.log("e", e);
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
// backup main unmarshalStreamBk
|
|
// backup main unmarshalStreamBk
|
|
- unmarshalStreamBk(e) {
|
|
|
|
|
|
+ unmarshalStream(e) {
|
|
var lt, ft, ht, pt, dt, _t, mt, vt, yt, Et;
|
|
var lt, ft, ht, pt, dt, _t, mt, vt, yt, Et;
|
|
const i = Date.now(),
|
|
const i = Date.now(),
|
|
o = new DataView(e);
|
|
o = new DataView(e);
|
|
|
|
|
|
- if (o.getUint32(0) != 1437227610) return !1;
|
|
|
|
|
|
+ if (o.getUint32(0) != 1437227610) return false; // flag auth
|
|
|
|
+
|
|
|
|
+
|
|
o.getUint16(4);
|
|
o.getUint16(4);
|
|
const c = o.getUint16(6),
|
|
const c = o.getUint16(6),
|
|
d = o.getUint16(8),
|
|
d = o.getUint16(8),
|
|
_ = d,
|
|
_ = d,
|
|
b = o.getUint16(10);
|
|
b = o.getUint16(10);
|
|
- let k = !1;
|
|
|
|
- b == 1 && (k = !0);
|
|
|
|
|
|
+ let k = false;
|
|
|
|
+ b == 1 && (k = true);
|
|
const j = o.getUint32(12),
|
|
const j = o.getUint32(12),
|
|
$ = o.getUint32(16),
|
|
$ = o.getUint32(16),
|
|
_e = o.getUint32(20),
|
|
_e = o.getUint32(20),
|
|
@@ -991,10 +1012,9 @@ export default class Workers {
|
|
nt = j + $,
|
|
nt = j + $,
|
|
ot = e.byteLength - c,
|
|
ot = e.byteLength - c,
|
|
at = new Uint8Array(e, c, ot);
|
|
at = new Uint8Array(e, c, ot);
|
|
|
|
+
|
|
this.calcSendTimeDiff(_e);
|
|
this.calcSendTimeDiff(_e);
|
|
|
|
|
|
- // console.log("rt", rt);
|
|
|
|
- // console.log("$", $);
|
|
|
|
console.log("流--", e.byteLength);
|
|
console.log("流--", e.byteLength);
|
|
// debugger;
|
|
// debugger;
|
|
const down = Date.now();
|
|
const down = Date.now();
|
|
@@ -1004,7 +1024,7 @@ export default class Workers {
|
|
defaultLogger.error(
|
|
defaultLogger.error(
|
|
"Stream Protocal Violation: receive illegal stream in Pano mode"
|
|
"Stream Protocal Violation: receive illegal stream in Pano mode"
|
|
),
|
|
),
|
|
- !0
|
|
|
|
|
|
+ true
|
|
);
|
|
);
|
|
if (ot === nt) {
|
|
if (ot === nt) {
|
|
this.receivedMedia++;
|
|
this.receivedMedia++;
|
|
@@ -1018,6 +1038,7 @@ export default class Workers {
|
|
: gt - this.lastClientTS < 16 && this.clientFrameFast++;
|
|
: gt - this.lastClientTS < 16 && this.clientFrameFast++;
|
|
const St = $ === 0,
|
|
const St = $ === 0,
|
|
xt = _e - this.lastServerTS;
|
|
xt = _e - this.lastServerTS;
|
|
|
|
+
|
|
this.lastServerTS != 0 &&
|
|
this.lastServerTS != 0 &&
|
|
((d + 65536 - this.lastSeq) % 65536 === 1 &&
|
|
((d + 65536 - this.lastSeq) % 65536 === 1 &&
|
|
this.lastIsPureMeta == St &&
|
|
this.lastIsPureMeta == St &&
|
|
@@ -1030,15 +1051,20 @@ export default class Workers {
|
|
(this.lastIsPureMeta = St),
|
|
(this.lastIsPureMeta = St),
|
|
(this.lastServerTS = _e),
|
|
(this.lastServerTS = _e),
|
|
(this.lastClientTS = gt);
|
|
(this.lastClientTS = gt);
|
|
- const bt = At.subarray(0, j),
|
|
|
|
- Rt = Date.now(),
|
|
|
|
- Mt = JSON.parse(this.Stringify(bt)),
|
|
|
|
- Pt = Date.now();
|
|
|
|
- this.showAllReceivedMetadata && console.log(_e, gt, Mt),
|
|
|
|
- this.metaParseAraay.push(Pt - Rt),
|
|
|
|
- (lt = Mt.traceIds) != null &&
|
|
|
|
- lt.length &&
|
|
|
|
- this.processMetaWithTraceId(Mt),
|
|
|
|
|
|
+
|
|
|
|
+ const bt = At.subarray(0, j);
|
|
|
|
+ const Rt = Date.now();
|
|
|
|
+ const Mt = JSON.parse(this.Stringify(bt)); // json 与帧map的坐标数据
|
|
|
|
+ const Pt = Date.now();
|
|
|
|
+
|
|
|
|
+ this.showAllReceivedMetadata && console.log(_e, gt, Mt);
|
|
|
|
+
|
|
|
|
+ // console.log("Pt - Rt", Pt - Rt, Pt, Rt);
|
|
|
|
+ this.metaParseArray.push(Pt - Rt);
|
|
|
|
+
|
|
|
|
+ (lt = Mt.traceIds) != null &&
|
|
|
|
+ lt.length &&
|
|
|
|
+ this.processMetaWithTraceId(Mt),
|
|
$ != 0 &&
|
|
$ != 0 &&
|
|
this.moveStartPts == -1 &&
|
|
this.moveStartPts == -1 &&
|
|
this.inMovingMode &&
|
|
this.inMovingMode &&
|
|
@@ -1051,7 +1077,9 @@ export default class Workers {
|
|
this.moveStartPts,
|
|
this.moveStartPts,
|
|
this.MoveResponseDelay
|
|
this.MoveResponseDelay
|
|
));
|
|
));
|
|
|
|
+
|
|
const It = this.getIsMoving(Mt);
|
|
const It = this.getIsMoving(Mt);
|
|
|
|
+
|
|
if (
|
|
if (
|
|
(this.inMovingMode &&
|
|
(this.inMovingMode &&
|
|
It == 0 &&
|
|
It == 0 &&
|
|
@@ -1080,6 +1108,8 @@ export default class Workers {
|
|
: pt.player) == null
|
|
: pt.player) == null
|
|
? void 0
|
|
? void 0
|
|
: dt.position);
|
|
: dt.position);
|
|
|
|
+
|
|
|
|
+ //封装格式
|
|
const Dt = {
|
|
const Dt = {
|
|
t: 0,
|
|
t: 0,
|
|
data: At,
|
|
data: At,
|
|
@@ -1094,14 +1124,15 @@ export default class Workers {
|
|
cachedKey: rt,
|
|
cachedKey: rt,
|
|
position: st,
|
|
position: st,
|
|
};
|
|
};
|
|
|
|
+ // console.warn('Dt',Dt);
|
|
if (this.inPanoMode) {
|
|
if (this.inPanoMode) {
|
|
// console.log('接受webrtc请求:'+JSON.stringify(Mt));
|
|
// console.log('接受webrtc请求:'+JSON.stringify(Mt));
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: Mt,
|
|
signal: Mt,
|
|
pts: -1,
|
|
pts: -1,
|
|
- alreadyUpdateYUV: !0,
|
|
|
|
|
|
+ alreadyUpdateYUV: true,
|
|
});
|
|
});
|
|
- return !0;
|
|
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
if (
|
|
if (
|
|
@@ -1114,8 +1145,13 @@ export default class Workers {
|
|
metric: "firstMediaArravalAt",
|
|
metric: "firstMediaArravalAt",
|
|
value: Ct,
|
|
value: Ct,
|
|
group: "joinRoom",
|
|
group: "joinRoom",
|
|
- }),
|
|
|
|
- (this.firstMediaReceived = !0);
|
|
|
|
|
|
+ });
|
|
|
|
+ this.downloadBlob(
|
|
|
|
+ [At.buffer],
|
|
|
|
+ `first.h264`,
|
|
|
|
+ "application/octet-stream"
|
|
|
|
+ );
|
|
|
|
+ this.firstMediaReceived = true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
const At = this.hasFrmCntInCache(_);
|
|
const At = this.hasFrmCntInCache(_);
|
|
@@ -1129,6 +1165,7 @@ export default class Workers {
|
|
0,
|
|
0,
|
|
nt
|
|
nt
|
|
);
|
|
);
|
|
|
|
+
|
|
(this.cacheFrameComposes[At].frameCnt = -1),
|
|
(this.cacheFrameComposes[At].frameCnt = -1),
|
|
(this.cacheFrameComposes[At].size = 0),
|
|
(this.cacheFrameComposes[At].size = 0),
|
|
(this.cacheFrameComposes[At].startReceiveTime = 0),
|
|
(this.cacheFrameComposes[At].startReceiveTime = 0),
|
|
@@ -1146,12 +1183,14 @@ export default class Workers {
|
|
this.frameClientCircular.add(St - this.lastClientTS)),
|
|
this.frameClientCircular.add(St - this.lastClientTS)),
|
|
(this.lastServerTS = _e),
|
|
(this.lastServerTS = _e),
|
|
(this.lastClientTS = St);
|
|
(this.lastClientTS = St);
|
|
|
|
+
|
|
const xt = gt.subarray(0, j),
|
|
const xt = gt.subarray(0, j),
|
|
bt = Date.now(),
|
|
bt = Date.now(),
|
|
Rt = JSON.parse(this.Stringify(xt)),
|
|
Rt = JSON.parse(this.Stringify(xt)),
|
|
Mt = Date.now();
|
|
Mt = Date.now();
|
|
|
|
+
|
|
this.showAllReceivedMetadata && console.log(_e, St, Rt),
|
|
this.showAllReceivedMetadata && console.log(_e, St, Rt),
|
|
- this.metaParseAraay.push(Mt - bt),
|
|
|
|
|
|
+ this.metaParseArray.push(Mt - bt),
|
|
(_t = Rt.traceIds) != null &&
|
|
(_t = Rt.traceIds) != null &&
|
|
_t.length &&
|
|
_t.length &&
|
|
this.processMetaWithTraceId(Rt),
|
|
this.processMetaWithTraceId(Rt),
|
|
@@ -1190,6 +1229,7 @@ export default class Workers {
|
|
: yt.player) == null
|
|
: yt.player) == null
|
|
? void 0
|
|
? void 0
|
|
: Et.position);
|
|
: Et.position);
|
|
|
|
+
|
|
const It = {
|
|
const It = {
|
|
t: 0,
|
|
t: 0,
|
|
data: gt,
|
|
data: gt,
|
|
@@ -1204,14 +1244,20 @@ export default class Workers {
|
|
cachedKey: rt,
|
|
cachedKey: rt,
|
|
position: st,
|
|
position: st,
|
|
};
|
|
};
|
|
|
|
+ //有效Iframe
|
|
|
|
+ console.error("IT", It);
|
|
|
|
+ console.log("It.data", It.data);
|
|
|
|
+
|
|
|
|
+ // this.downloadBlob([At.buffer], `${It.frameCnt}.gt.h264`, "application/octet-stream");
|
|
|
|
+
|
|
if (this.inPanoMode) {
|
|
if (this.inPanoMode) {
|
|
- console.log("接受webrtc请求:" + JSON.stringify(Rt));
|
|
|
|
|
|
+ // console.log("接受webrtc请求:" + JSON.stringify(Rt));
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: Rt,
|
|
signal: Rt,
|
|
pts: -1,
|
|
pts: -1,
|
|
- alreadyUpdateYUV: !0,
|
|
|
|
|
|
+ alreadyUpdateYUV: true,
|
|
});
|
|
});
|
|
- return !0;
|
|
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
if (
|
|
if (
|
|
(this.decoderWorker.postMessage(It, [gt.buffer]),
|
|
(this.decoderWorker.postMessage(It, [gt.buffer]),
|
|
@@ -1226,7 +1272,7 @@ export default class Workers {
|
|
value: Dt,
|
|
value: Dt,
|
|
group: "joinRoom",
|
|
group: "joinRoom",
|
|
}),
|
|
}),
|
|
- (this.firstMediaReceived = !0);
|
|
|
|
|
|
+ (this.firstMediaReceived = true);
|
|
}
|
|
}
|
|
} else
|
|
} else
|
|
this.cacheFrameComposes[At].size > nt &&
|
|
this.cacheFrameComposes[At].size > nt &&
|
|
@@ -1254,13 +1300,13 @@ export default class Workers {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const ct = Date.now() - i;
|
|
const ct = Date.now() - i;
|
|
- return this.unmarshalStreamExecutionArray.add(ct), !0;
|
|
|
|
|
|
+ return this.unmarshalStreamExecutionArray.add(ct), true;
|
|
}
|
|
}
|
|
reset() {
|
|
reset() {
|
|
defaultLogger.debug("Worker reset is called"),
|
|
defaultLogger.debug("Worker reset is called"),
|
|
(this.cacheFrameCnt = 0),
|
|
(this.cacheFrameCnt = 0),
|
|
(this.receivedMedia = 0),
|
|
(this.receivedMedia = 0),
|
|
- (this.reconnectSignal = !0),
|
|
|
|
|
|
+ (this.reconnectSignal = true),
|
|
this.decoderWorker.postMessage({
|
|
this.decoderWorker.postMessage({
|
|
t: 4,
|
|
t: 4,
|
|
});
|
|
});
|
|
@@ -1274,7 +1320,7 @@ export default class Workers {
|
|
this.decoderWorker.postMessage({
|
|
this.decoderWorker.postMessage({
|
|
t: 6,
|
|
t: 6,
|
|
});
|
|
});
|
|
- this.saveframe = !1;
|
|
|
|
|
|
+ this.saveframe = false;
|
|
}
|
|
}
|
|
|
|
|
|
if (this.SaveMediaStream) {
|
|
if (this.SaveMediaStream) {
|
|
@@ -1282,23 +1328,23 @@ export default class Workers {
|
|
this.decoderWorker.postMessage({
|
|
this.decoderWorker.postMessage({
|
|
t: 7,
|
|
t: 7,
|
|
}),
|
|
}),
|
|
- (this.SaveMediaStream = !1);
|
|
|
|
|
|
+ (this.SaveMediaStream = false);
|
|
}
|
|
}
|
|
|
|
|
|
const i = new Uint8Array(e);
|
|
const i = new Uint8Array(e);
|
|
- if (i.length >= 4 && this.isHeartBeatPacket(i.buffer, i.length) == !0) {
|
|
|
|
- console.log("接受webrtc请求:心跳");
|
|
|
|
|
|
+ if (i.length >= 4 && this.isHeartBeatPacket(i.buffer, i.length) == true) {
|
|
|
|
+ // console.log("接受webrtc请求:心跳");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (i.length > 36 && this.unmarshalStream(i.buffer) == !0) {
|
|
|
|
|
|
+ if (i.length > 36 && this.unmarshalStream(i.buffer) == true) {
|
|
this.reconnectSignal &&
|
|
this.reconnectSignal &&
|
|
(this.executeFunction("reconnectedFrame", {}),
|
|
(this.executeFunction("reconnectedFrame", {}),
|
|
- (this.reconnectSignal = !1));
|
|
|
|
- console.log("接受webrtc请求:视频流");
|
|
|
|
|
|
+ (this.reconnectSignal = false));
|
|
|
|
+ // console.log("接受webrtc请求:视频流");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (i.length > 20 && this.unmarshalPano(i.buffer) == !0) {
|
|
|
|
- console.log("接受webrtc请求:全景图");
|
|
|
|
|
|
+ if (i.length > 20 && this.unmarshalPano(i.buffer) == true) {
|
|
|
|
+ // console.log("接受webrtc请求:全景图");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.noWasmBytesReceived += e.byteLength;
|
|
this.noWasmBytesReceived += e.byteLength;
|
|
@@ -1307,7 +1353,7 @@ export default class Workers {
|
|
this.executeFunction("signal", {
|
|
this.executeFunction("signal", {
|
|
signal: o,
|
|
signal: o,
|
|
pts: -1,
|
|
pts: -1,
|
|
- alreadyUpdateYUV: !0,
|
|
|
|
|
|
+ alreadyUpdateYUV: true,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
changePanoMode(e) {
|
|
changePanoMode(e) {
|