|
@@ -999,8 +999,9 @@ export default class Workers {
|
|
// backup main unmarshalStreamBk
|
|
// backup main unmarshalStreamBk
|
|
unmarshalStream(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(),
|
|
|
|
- o = new DataView(e);
|
|
|
|
|
|
+
|
|
|
|
+ const i = Date.now();
|
|
|
|
+ const o = new DataView(e);
|
|
|
|
|
|
if (o.getUint32(0) != 1437227610) return false; // 32位0bit 流标识位
|
|
if (o.getUint32(0) != 1437227610) return false; // 32位0bit 流标识位
|
|
|
|
|
|
@@ -1008,11 +1009,11 @@ export default class Workers {
|
|
const c = o.getUint16(6), // 16位6bit 36 ? 可能是混数
|
|
const c = o.getUint16(6), // 16位6bit 36 ? 可能是混数
|
|
d = o.getUint16(8), // 16位8bit 存当前帧数
|
|
d = o.getUint16(8), // 16位8bit 存当前帧数
|
|
fCnt = d,
|
|
fCnt = d,
|
|
- b = o.getUint16(10); // 1 3 255 1,3 ? 方向 空包 255
|
|
|
|
|
|
+ b = o.getUint16(10); // 1 3 255 1,3 ? 方向 空包 255 可能是 DIR 方向
|
|
let k = false;
|
|
let k = false;
|
|
b == 1 && (k = true); //
|
|
b == 1 && (k = true); //
|
|
- const j = o.getUint32(12), // 16位12bit ? 帧 byteLength 长度
|
|
|
|
- $ = o.getUint32(16), // 16位16bit ?当前大小 0 是空包
|
|
|
|
|
|
+ const j = o.getUint32(12), // 16位12bit ? 帧 byteLength 长度 metaLen
|
|
|
|
+ $ = o.getUint32(16), // 16位16bit 有效流总大小 0 是空包 metaLen
|
|
_e = o.getUint32(20), // calcSendTimeDiff 与时间有关
|
|
_e = o.getUint32(20), // calcSendTimeDiff 与时间有关
|
|
et = o.getUint16(24), // 大多数为 0,待定 与inPanoMode 开关有关系
|
|
et = o.getUint16(24), // 大多数为 0,待定 与inPanoMode 开关有关系
|
|
tt = o.getUint16(26), // 0 / 1 待定 与用户状态有关
|
|
tt = o.getUint16(26), // 0 / 1 待定 与用户状态有关
|
|
@@ -1024,8 +1025,21 @@ export default class Workers {
|
|
|
|
|
|
this.calcSendTimeDiff(_e);
|
|
this.calcSendTimeDiff(_e);
|
|
|
|
|
|
- console.log("流--", e.byteLength);
|
|
|
|
- console.log("gemer1", fCnt, ot, it);
|
|
|
|
|
|
+ // console.log("流--", e.byteLength);
|
|
|
|
+
|
|
|
|
+ console.log("gemer", {
|
|
|
|
+ byteLength: e.byteLength,
|
|
|
|
+ frame: fCnt,
|
|
|
|
+ mediaLen: $,
|
|
|
|
+ metaLen: j,
|
|
|
|
+ serverTime: _e,
|
|
|
|
+ it: it,
|
|
|
|
+ start: c,
|
|
|
|
+ end: ot,
|
|
|
|
+ total: nt,
|
|
|
|
+ isPureMeta: ot === nt,
|
|
|
|
+ at: at,
|
|
|
|
+ });
|
|
|
|
|
|
// debugger;
|
|
// debugger;
|
|
const down = Date.now();
|
|
const down = Date.now();
|
|
@@ -1072,8 +1086,7 @@ export default class Workers {
|
|
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));
|
|
|
|
-
|
|
|
|
|
|
+ console.log("gemer2", fCnt, it, Mt);
|
|
|
|
|
|
this.showAllReceivedMetadata && console.log(_e, gt, Mt);
|
|
this.showAllReceivedMetadata && console.log(_e, gt, Mt);
|
|
|
|
|
|
@@ -1161,20 +1174,34 @@ export default class Workers {
|
|
) {
|
|
) {
|
|
this.firstMediaArraval = Date.now();
|
|
this.firstMediaArraval = Date.now();
|
|
const Ct = this.firstMediaArraval - this.rtcp.network.room._startTime;
|
|
const Ct = this.firstMediaArraval - this.rtcp.network.room._startTime;
|
|
|
|
+
|
|
defaultLogger.infoAndReportMeasurement({
|
|
defaultLogger.infoAndReportMeasurement({
|
|
metric: "firstMediaArravalAt",
|
|
metric: "firstMediaArravalAt",
|
|
value: Ct,
|
|
value: Ct,
|
|
group: "joinRoom",
|
|
group: "joinRoom",
|
|
});
|
|
});
|
|
- this.downloadBlob(
|
|
|
|
- [At.buffer],
|
|
|
|
- `first.h264`,
|
|
|
|
- "application/octet-stream"
|
|
|
|
- );
|
|
|
|
|
|
+ // this.downloadBlob(
|
|
|
|
+ // [At.buffer],
|
|
|
|
+ // `first.h264`,
|
|
|
|
+ // "application/octet-stream"
|
|
|
|
+ // );
|
|
this.firstMediaReceived = true;
|
|
this.firstMediaReceived = true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
const At = this.hasFrmCntInCache(fCnt);
|
|
const At = this.hasFrmCntInCache(fCnt);
|
|
|
|
+ // console.log("At", At, at, it);
|
|
|
|
+ // console.log(
|
|
|
|
+ // "this.cacheFrameComposes[At].buffer",
|
|
|
|
+ // this.cacheFrameComposes[At],
|
|
|
|
+ // );
|
|
|
|
+
|
|
|
|
+ // if (At !== -1) {
|
|
|
|
+ // console.log(
|
|
|
|
+ // "this.cacheFrameComposes[At].buffer",
|
|
|
|
+ // this.cacheFrameComposes[At].buffer
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+
|
|
if (At != -1)
|
|
if (At != -1)
|
|
if (
|
|
if (
|
|
(this.cacheFrameComposes[At].buffer.set(at, it),
|
|
(this.cacheFrameComposes[At].buffer.set(at, it),
|
|
@@ -1186,15 +1213,18 @@ export default class Workers {
|
|
nt
|
|
nt
|
|
);
|
|
);
|
|
|
|
|
|
- (this.cacheFrameComposes[At].frameCnt = -1),
|
|
|
|
- (this.cacheFrameComposes[At].size = 0),
|
|
|
|
- (this.cacheFrameComposes[At].startReceiveTime = 0),
|
|
|
|
- (this.cacheFrameComposes[At].serverTime = 0),
|
|
|
|
- this.receivedMedia++,
|
|
|
|
- _e - this.lastServerTS > 60
|
|
|
|
- ? this.serverFrameSlow++
|
|
|
|
- : _e - this.lastServerTS < 16 && this.serverFrameFast++;
|
|
|
|
|
|
+ this.cacheFrameComposes[At].frameCnt = -1;
|
|
|
|
+ this.cacheFrameComposes[At].size = 0;
|
|
|
|
+ this.cacheFrameComposes[At].startReceiveTime = 0;
|
|
|
|
+ this.cacheFrameComposes[At].serverTime = 0;
|
|
|
|
+ this.receivedMedia++;
|
|
|
|
+
|
|
|
|
+ _e - this.lastServerTS > 60
|
|
|
|
+ ? this.serverFrameSlow++
|
|
|
|
+ : _e - this.lastServerTS < 16 && this.serverFrameFast++;
|
|
|
|
+
|
|
const St = Date.now();
|
|
const St = Date.now();
|
|
|
|
+
|
|
St - this.lastClientTS > 60
|
|
St - this.lastClientTS > 60
|
|
? this.clientFrameSlow++
|
|
? this.clientFrameSlow++
|
|
: St - this.lastClientTS < 16 && this.clientFrameFast++,
|
|
: St - this.lastClientTS < 16 && this.clientFrameFast++,
|
|
@@ -1204,10 +1234,11 @@ export default class Workers {
|
|
(this.lastServerTS = _e),
|
|
(this.lastServerTS = _e),
|
|
(this.lastClientTS = St);
|
|
(this.lastClientTS = St);
|
|
|
|
|
|
- const xt = gt.subarray(0, j),
|
|
|
|
- bt = Date.now(),
|
|
|
|
- Rt = JSON.parse(this.Stringify(xt)),
|
|
|
|
- Mt = Date.now();
|
|
|
|
|
|
+ const xt = gt.subarray(0, j);
|
|
|
|
+ // console.log("xt", xt);
|
|
|
|
+ const bt = Date.now();
|
|
|
|
+ const Rt = JSON.parse(this.Stringify(xt));
|
|
|
|
+ const Mt = Date.now();
|
|
|
|
|
|
this.showAllReceivedMetadata && console.log(_e, St, Rt),
|
|
this.showAllReceivedMetadata && console.log(_e, St, Rt),
|
|
this.metaParseArray.push(Mt - bt),
|
|
this.metaParseArray.push(Mt - bt),
|
|
@@ -1266,8 +1297,14 @@ export default class Workers {
|
|
};
|
|
};
|
|
//有效Iframe
|
|
//有效Iframe
|
|
console.error("IT", fCnt, It);
|
|
console.error("IT", fCnt, It);
|
|
-
|
|
|
|
- // this.downloadBlob([It.data], `${It.frameCnt}.gt.h264`, "application/octet-stream");
|
|
|
|
|
|
+ console.error("IT", fCnt, JSON.stringify(Rt));
|
|
|
|
+ console.log("IT-fCnt", It.data);
|
|
|
|
+
|
|
|
|
+ this.downloadBlob(
|
|
|
|
+ It.data.subarray(It.metaLen, It.metaLen + It.mediaLen),
|
|
|
|
+ `${It.frameCnt}.264`,
|
|
|
|
+ "application/json"
|
|
|
|
+ );
|
|
|
|
|
|
if (this.inPanoMode) {
|
|
if (this.inPanoMode) {
|
|
// console.log("接受webrtc请求:" + JSON.stringify(Rt));
|
|
// console.log("接受webrtc请求:" + JSON.stringify(Rt));
|
|
@@ -1355,6 +1392,7 @@ export default class Workers {
|
|
// console.log("接受webrtc请求:心跳");
|
|
// console.log("接受webrtc请求:心跳");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
if (i.length > 36 && this.unmarshalStream(i.buffer) == true) {
|
|
if (i.length > 36 && this.unmarshalStream(i.buffer) == true) {
|
|
this.reconnectSignal &&
|
|
this.reconnectSignal &&
|
|
(this.executeFunction("reconnectedFrame", {}),
|
|
(this.executeFunction("reconnectedFrame", {}),
|