|
@@ -378,6 +378,7 @@ export default class Workers {
|
|
status: 0,
|
|
status: 0,
|
|
};
|
|
};
|
|
this.joyStickTraceIdMap.set(o, d);
|
|
this.joyStickTraceIdMap.set(o, d);
|
|
|
|
+
|
|
const _ = setTimeout(() => {
|
|
const _ = setTimeout(() => {
|
|
if ((_ && clearTimeout(_), this.joyStickTraceIdMap.has(o))) {
|
|
if ((_ && clearTimeout(_), this.joyStickTraceIdMap.has(o))) {
|
|
const b = this.joyStickTraceIdMap.get(o);
|
|
const b = this.joyStickTraceIdMap.get(o);
|
|
@@ -524,7 +525,9 @@ export default class Workers {
|
|
|
|
|
|
this.getPtr = (this.getPtr + 1) % this.cachedLength;
|
|
this.getPtr = (this.getPtr + 1) % this.cachedLength;
|
|
}
|
|
}
|
|
|
|
+
|
|
const s = e.data.metadata;
|
|
const s = e.data.metadata;
|
|
|
|
+
|
|
if ((b = s == null ? void 0 : s.traceIds) != null && b.length)
|
|
if ((b = s == null ? void 0 : s.traceIds) != null && b.length)
|
|
for (const k of s.traceIds) {
|
|
for (const k of s.traceIds) {
|
|
if (this.traceIdMap.has(k)) {
|
|
if (this.traceIdMap.has(k)) {
|
|
@@ -554,7 +557,7 @@ export default class Workers {
|
|
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(_);
|
|
@@ -668,24 +671,28 @@ export default class Workers {
|
|
};
|
|
};
|
|
this.cacheFrameComposes.push(s);
|
|
this.cacheFrameComposes.push(s);
|
|
}
|
|
}
|
|
- (USER_ID = e.userID),
|
|
|
|
- (PAGE_SESSION = e.pageSession),
|
|
|
|
- (SERVER_SESSION = e.serverSession);
|
|
|
|
|
|
+ USER_ID = e.userID;
|
|
|
|
+ PAGE_SESSION = e.pageSession;
|
|
|
|
+ SERVER_SESSION = e.serverSession;
|
|
|
|
|
|
// console.log("v2Decoder", v2Decoder);
|
|
// console.log("v2Decoder", v2Decoder);
|
|
|
|
+
|
|
const i = new Blob([v2Decoder], {
|
|
const i = new Blob([v2Decoder], {
|
|
type: "application/javascript",
|
|
type: "application/javascript",
|
|
});
|
|
});
|
|
- (this.decoderWorker = new Worker(URL.createObjectURL(i))),
|
|
|
|
- this.decoderWorker.postMessage({
|
|
|
|
- t: 9,
|
|
|
|
- url: WASM_URLS[WASM_Version],
|
|
|
|
- jitterLength: DECODER_PASSIVE_JITTER,
|
|
|
|
- }),
|
|
|
|
- this.decoderWorker.postMessage({
|
|
|
|
- t: 1,
|
|
|
|
- config: e,
|
|
|
|
- });
|
|
|
|
|
|
+ this.decoderWorker = new Worker(URL.createObjectURL(i));
|
|
|
|
+
|
|
|
|
+ // this.enable_decoder_queue_logging();
|
|
|
|
+
|
|
|
|
+ this.decoderWorker.postMessage({
|
|
|
|
+ t: 9,
|
|
|
|
+ url: WASM_URLS[WASM_Version],
|
|
|
|
+ jitterLength: DECODER_PASSIVE_JITTER,
|
|
|
|
+ });
|
|
|
|
+ this.decoderWorker.postMessage({
|
|
|
|
+ t: 1,
|
|
|
|
+ config: e,
|
|
|
|
+ });
|
|
|
|
|
|
return new Promise((o) => {
|
|
return new Promise((o) => {
|
|
this.decoderWorker.onmessage = (s) => {
|
|
this.decoderWorker.onmessage = (s) => {
|
|
@@ -713,7 +720,8 @@ export default class Workers {
|
|
"-" +
|
|
"-" +
|
|
c +
|
|
c +
|
|
".264";
|
|
".264";
|
|
- uploadStream(COS_PREFIX + d, s.data.fileObj);
|
|
|
|
|
|
+ console.log(" s.data.fileObj", s.data.fileObj);
|
|
|
|
+ // uploadStream(COS_PREFIX + d, s.data.fileObj);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case 5:
|
|
case 5:
|
|
@@ -981,8 +989,10 @@ export default class Workers {
|
|
this.serverSendTimeArray.add(i), (this.prevSenderTs = e);
|
|
this.serverSendTimeArray.add(i), (this.prevSenderTs = e);
|
|
}
|
|
}
|
|
// new unmarshalStream
|
|
// new unmarshalStream
|
|
- unmarshalStreamBk(e) {
|
|
|
|
- console.log("e", e);
|
|
|
|
|
|
+ unmarshalStreamBk(data) {
|
|
|
|
+ const dateView = new DataView(data);
|
|
|
|
+ // const pts = Date.now();
|
|
|
|
+ if (dateView.getUint32(0) != 1437227610) return false; // flag auth
|
|
|
|
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -992,30 +1002,31 @@ export default class Workers {
|
|
const i = Date.now(),
|
|
const i = Date.now(),
|
|
o = new DataView(e);
|
|
o = new DataView(e);
|
|
|
|
|
|
- if (o.getUint32(0) != 1437227610) return false; // flag auth
|
|
|
|
|
|
+ if (o.getUint32(0) != 1437227610) return false; // 32位0bit 流标识位
|
|
|
|
|
|
-
|
|
|
|
- o.getUint16(4);
|
|
|
|
- const c = o.getUint16(6),
|
|
|
|
- d = o.getUint16(8),
|
|
|
|
- _ = d,
|
|
|
|
- b = o.getUint16(10);
|
|
|
|
|
|
+ o.getUint16(4); // 2 ?暂时未用
|
|
|
|
+ const c = o.getUint16(6), // 16位6bit 36 ? 可能是混数
|
|
|
|
+ d = o.getUint16(8), // 16位8bit 存当前帧数
|
|
|
|
+ fCnt = d,
|
|
|
|
+ b = o.getUint16(10); // 1 3 255 1,3 ? 方向 空包 255
|
|
let k = false;
|
|
let k = false;
|
|
- b == 1 && (k = true);
|
|
|
|
- const j = o.getUint32(12),
|
|
|
|
- $ = o.getUint32(16),
|
|
|
|
- _e = o.getUint32(20),
|
|
|
|
- et = o.getUint16(24),
|
|
|
|
- tt = o.getUint16(26),
|
|
|
|
- rt = o.getUint32(28),
|
|
|
|
- it = o.getUint32(c - 4),
|
|
|
|
- nt = j + $,
|
|
|
|
- ot = e.byteLength - c,
|
|
|
|
- at = new Uint8Array(e, c, ot);
|
|
|
|
|
|
+ b == 1 && (k = true); //
|
|
|
|
+ const j = o.getUint32(12), // 16位12bit ? 帧 byteLength 长度
|
|
|
|
+ $ = o.getUint32(16), // 16位16bit ?当前大小 0 是空包
|
|
|
|
+ _e = o.getUint32(20), // calcSendTimeDiff 与时间有关
|
|
|
|
+ et = o.getUint16(24), // 大多数为 0,待定 与inPanoMode 开关有关系
|
|
|
|
+ tt = o.getUint16(26), // 0 / 1 待定 与用户状态有关
|
|
|
|
+ rt = o.getUint32(28), // 0 cachedKey
|
|
|
|
+ it = o.getUint32(c - 4), // ?同步I帧或大小slice steam切片 按开始大小 $是总大小
|
|
|
|
+ nt = j + $, // ?cnt 宏块 总包大小
|
|
|
|
+ ot = e.byteLength - c, // cnt 宏块 有效长段
|
|
|
|
+ at = new Uint8Array(e, c, ot); // e流 真实有效 以32位前6bit 可能是留白,
|
|
|
|
|
|
this.calcSendTimeDiff(_e);
|
|
this.calcSendTimeDiff(_e);
|
|
|
|
|
|
console.log("流--", e.byteLength);
|
|
console.log("流--", e.byteLength);
|
|
|
|
+ console.log("gemer1", fCnt, ot, it);
|
|
|
|
+
|
|
// debugger;
|
|
// debugger;
|
|
const down = Date.now();
|
|
const down = Date.now();
|
|
let st;
|
|
let st;
|
|
@@ -1026,8 +1037,11 @@ export default class Workers {
|
|
),
|
|
),
|
|
true
|
|
true
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
+ // cnt总包大小 === cnt 有效长段
|
|
if (ot === nt) {
|
|
if (ot === nt) {
|
|
this.receivedMedia++;
|
|
this.receivedMedia++;
|
|
|
|
+ // ?宏块位置重新较正, c是留白,从留白开计?
|
|
const At = new Uint8Array(e).subarray(c);
|
|
const At = new Uint8Array(e).subarray(c);
|
|
_e - this.lastServerTS > 60
|
|
_e - this.lastServerTS > 60
|
|
? this.serverFrameSlow++
|
|
? this.serverFrameSlow++
|
|
@@ -1052,11 +1066,15 @@ export default class Workers {
|
|
(this.lastServerTS = _e),
|
|
(this.lastServerTS = _e),
|
|
(this.lastClientTS = gt);
|
|
(this.lastClientTS = gt);
|
|
|
|
|
|
- const bt = At.subarray(0, j);
|
|
|
|
|
|
+ const bt = At.subarray(0, j); // 将坐标插入流,再拿出来?
|
|
|
|
+
|
|
const Rt = Date.now();
|
|
const Rt = Date.now();
|
|
const Mt = JSON.parse(this.Stringify(bt)); // json 与帧map的坐标数据
|
|
const Mt = JSON.parse(this.Stringify(bt)); // json 与帧map的坐标数据
|
|
const Pt = Date.now();
|
|
const Pt = Date.now();
|
|
|
|
|
|
|
|
+ // console.log("gemer2", fCnt, JSON.stringify(Mt));
|
|
|
|
+
|
|
|
|
+
|
|
this.showAllReceivedMetadata && console.log(_e, gt, Mt);
|
|
this.showAllReceivedMetadata && console.log(_e, gt, Mt);
|
|
|
|
|
|
// console.log("Pt - Rt", Pt - Rt, Pt, Rt);
|
|
// console.log("Pt - Rt", Pt - Rt, Pt, Rt);
|
|
@@ -1092,6 +1110,8 @@ export default class Workers {
|
|
Ot = Ct - this.lastMoveResponseTime;
|
|
Ot = Ct - this.lastMoveResponseTime;
|
|
this.moveResponseCircular.add(Ot), (this.lastMoveResponseTime = Ct);
|
|
this.moveResponseCircular.add(Ot), (this.lastMoveResponseTime = Ct);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 流与状态有关
|
|
(et || tt) &&
|
|
(et || tt) &&
|
|
(st =
|
|
(st =
|
|
(dt =
|
|
(dt =
|
|
@@ -1116,7 +1136,7 @@ export default class Workers {
|
|
mediaLen: $,
|
|
mediaLen: $,
|
|
metaLen: j,
|
|
metaLen: j,
|
|
metadata: Mt,
|
|
metadata: Mt,
|
|
- frameCnt: _,
|
|
|
|
|
|
+ frameCnt: fCnt,
|
|
server_ts: _e,
|
|
server_ts: _e,
|
|
isIDR: k,
|
|
isIDR: k,
|
|
cacheRequest: tt,
|
|
cacheRequest: tt,
|
|
@@ -1154,7 +1174,7 @@ export default class Workers {
|
|
this.firstMediaReceived = true;
|
|
this.firstMediaReceived = true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- const At = this.hasFrmCntInCache(_);
|
|
|
|
|
|
+ const At = this.hasFrmCntInCache(fCnt);
|
|
if (At != -1)
|
|
if (At != -1)
|
|
if (
|
|
if (
|
|
(this.cacheFrameComposes[At].buffer.set(at, it),
|
|
(this.cacheFrameComposes[At].buffer.set(at, it),
|
|
@@ -1236,7 +1256,7 @@ export default class Workers {
|
|
mediaLen: $,
|
|
mediaLen: $,
|
|
metaLen: j,
|
|
metaLen: j,
|
|
metadata: Rt,
|
|
metadata: Rt,
|
|
- frameCnt: _,
|
|
|
|
|
|
+ frameCnt: fCnt,
|
|
server_ts: _e,
|
|
server_ts: _e,
|
|
isIDR: k,
|
|
isIDR: k,
|
|
cacheRequest: tt,
|
|
cacheRequest: tt,
|
|
@@ -1245,10 +1265,9 @@ export default class Workers {
|
|
position: st,
|
|
position: st,
|
|
};
|
|
};
|
|
//有效Iframe
|
|
//有效Iframe
|
|
- console.error("IT", It);
|
|
|
|
- console.log("It.data", It.data);
|
|
|
|
-
|
|
|
|
- // this.downloadBlob([At.buffer], `${It.frameCnt}.gt.h264`, "application/octet-stream");
|
|
|
|
|
|
+ console.error("IT", fCnt, It);
|
|
|
|
+
|
|
|
|
+ // this.downloadBlob([It.data], `${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));
|
|
@@ -1294,7 +1313,7 @@ export default class Workers {
|
|
}
|
|
}
|
|
this.cacheFrameComposes[gt].buffer.set(at, it),
|
|
this.cacheFrameComposes[gt].buffer.set(at, it),
|
|
(this.cacheFrameComposes[gt].size = ot),
|
|
(this.cacheFrameComposes[gt].size = ot),
|
|
- (this.cacheFrameComposes[gt].frameCnt = _),
|
|
|
|
|
|
+ (this.cacheFrameComposes[gt].frameCnt = fCnt),
|
|
(this.cacheFrameComposes[gt].startReceiveTime = Date.now()),
|
|
(this.cacheFrameComposes[gt].startReceiveTime = Date.now()),
|
|
(this.cacheFrameComposes[gt].serverTime = _e);
|
|
(this.cacheFrameComposes[gt].serverTime = _e);
|
|
}
|
|
}
|