|
@@ -383,26 +383,26 @@ export default class Workers {
|
|
|
if(this.cachedStreams[this.setPtr] != null && this.cachedStreams[this.setPtr].byteLength != 0)
|
|
|
{
|
|
|
if(e.data.data == null){
|
|
|
- this.executeFunction("stream", {
|
|
|
- stream: this.cachedStreams[this.setPtr],
|
|
|
- width: this.cachedResolution[this.setPtr].width,
|
|
|
- height: this.cachedResolution[this.setPtr].height,
|
|
|
- pts: this.cachedPtss[this.setPtr]
|
|
|
- }),
|
|
|
- this.executeFunction("signal", {
|
|
|
- signal: this.cachedMetas[this.setPtr],
|
|
|
- pts: this.cachedPtss[this.setPtr],
|
|
|
- alreadyUpdateYUV: !0
|
|
|
- })
|
|
|
+ // this.executeFunction("stream", {
|
|
|
+ // stream: this.cachedStreams[this.setPtr],
|
|
|
+ // width: this.cachedResolution[this.setPtr].width,
|
|
|
+ // height: this.cachedResolution[this.setPtr].height,
|
|
|
+ // pts: this.cachedPtss[this.setPtr]
|
|
|
+ // }),
|
|
|
+ // this.executeFunction("signal", {
|
|
|
+ // signal: this.cachedMetas[this.setPtr],
|
|
|
+ // pts: this.cachedPtss[this.setPtr],
|
|
|
+ // alreadyUpdateYUV: !0
|
|
|
+ // })
|
|
|
}
|
|
|
else{
|
|
|
this.updateDropFrame += 1
|
|
|
}
|
|
|
- this.decoderWorker.postMessage({
|
|
|
- t: 2,
|
|
|
- frameCnt: this.cachedPtss[this.setPtr],
|
|
|
- buffer: this.cachedStreams[this.setPtr]
|
|
|
- }, [this.cachedStreams[this.setPtr].buffer])
|
|
|
+ // this.decoderWorker.postMessage({
|
|
|
+ // t: 2,
|
|
|
+ // frameCnt: this.cachedPtss[this.setPtr],
|
|
|
+ // buffer: this.cachedStreams[this.setPtr]
|
|
|
+ // }, [this.cachedStreams[this.setPtr].buffer])
|
|
|
}
|
|
|
this.getPtr = (this.getPtr + 1) % this.cachedLength
|
|
|
}
|
|
@@ -532,7 +532,7 @@ export default class Workers {
|
|
|
url: WASM_URLS[WASM_Version],
|
|
|
jitterLength: DECODER_PASSIVE_JITTER
|
|
|
});
|
|
|
-
|
|
|
+ window.decoderWorker = this.decoderWorker;
|
|
|
this.decoderWorker.postMessage({
|
|
|
t: 1,
|
|
|
config: e
|
|
@@ -551,13 +551,24 @@ export default class Workers {
|
|
|
r();
|
|
|
break;
|
|
|
case 3:
|
|
|
- this.SendCacheFrameInfo(n);
|
|
|
+ //this.SendCacheFrameInfo(n);
|
|
|
break;
|
|
|
case 4:
|
|
|
{
|
|
|
const o = new Date().toISOString()
|
|
|
, a = USER_ID + "-" + PAGE_SESSION + "-" + SERVER_SESSION + "-" + o + ".264";
|
|
|
- uploadStream(COS_PREFIX + a, n.data.fileObj);
|
|
|
+
|
|
|
+ let downloadURL = function(r, n) {
|
|
|
+ const o = document.createElement("a");
|
|
|
+ o.href = r,
|
|
|
+ o.download = n,
|
|
|
+ document.body.appendChild(o),
|
|
|
+ o.style.display = "none",
|
|
|
+ o.click(),
|
|
|
+ o.remove()
|
|
|
+ }
|
|
|
+ downloadURL(n.data.link, a)
|
|
|
+ //uploadStream(COS_PREFIX + a, n.data.fileObj);
|
|
|
break
|
|
|
}
|
|
|
case 5:
|
|
@@ -639,48 +650,48 @@ export default class Workers {
|
|
|
frameCnt: this.cachedPtss[e],
|
|
|
buffer: this.cachedStreams[e]
|
|
|
}, [this.cachedStreams[e].buffer]);
|
|
|
- const a = Date.now()
|
|
|
- , s = o - n
|
|
|
- , l = a - o;
|
|
|
- (s > 33 || l > 10) && defaultLogger.debug("[wwwarning] updateYUV takes ", s, " ms, postMessage takes ", l, " ms for index ", this.cachedPtss[e]),
|
|
|
- o - this.lastRenderTs > 84 && this.JankTimes++,
|
|
|
- o - this.lastRenderTs > 125 && this.bigJankTimes++,
|
|
|
- this.lastRenderTs = o;
|
|
|
- const u = o - n;
|
|
|
- this.updateYUVCircular.add(u);
|
|
|
- const c = this.cachedMetas[e];
|
|
|
- if ((r = c == null ? void 0 : c.traceIds) != null && r.length) {
|
|
|
- for (const h of c.traceIds)
|
|
|
- if (this.traceIdMap.has(h)) {
|
|
|
- const f = this.traceIdMap.get(h);
|
|
|
- if (f != null) {
|
|
|
- f.displayTime = Date.now(),
|
|
|
- f.status = 3;
|
|
|
- const d = f.receiveTime - f.startTime
|
|
|
- , _ = f.readyTime - f.receiveTime
|
|
|
- , g = f.displayTime - f.readyTime
|
|
|
- , m = f.displayTime - f.startTime;
|
|
|
- this.responseTimeArray.push(d),
|
|
|
- this.processTimeArray.push(_),
|
|
|
- this.displayTimeArray.push(g),
|
|
|
- this.overallTimeArray.push(m),
|
|
|
- this.traceIdMap.delete(h)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (this.cachedPtss[e] == this.moveStartPts && (this.MoveDisplayDelay = Date.now() - this.StartMovingTs),
|
|
|
- this.inMovingMode) {
|
|
|
- const h = Date.now()
|
|
|
- , f = h - this.lastMoveDisplayTime;
|
|
|
- this.moveDisplayCircular.add(f),
|
|
|
- this.lastMoveDisplayTime = h
|
|
|
- }
|
|
|
+ // const a = Date.now()
|
|
|
+ // , s = o - n
|
|
|
+ // , l = a - o;
|
|
|
+ // (s > 33 || l > 10) && defaultLogger.debug("[wwwarning] updateYUV takes ", s, " ms, postMessage takes ", l, " ms for index ", this.cachedPtss[e]),
|
|
|
+ // o - this.lastRenderTs > 84 && this.JankTimes++,
|
|
|
+ // o - this.lastRenderTs > 125 && this.bigJankTimes++,
|
|
|
+ // this.lastRenderTs = o;
|
|
|
+ // const u = o - n;
|
|
|
+ // this.updateYUVCircular.add(u);
|
|
|
+ // const c = this.cachedMetas[e];
|
|
|
+ // if ((r = c == null ? void 0 : c.traceIds) != null && r.length) {
|
|
|
+ // for (const h of c.traceIds)
|
|
|
+ // if (this.traceIdMap.has(h)) {
|
|
|
+ // const f = this.traceIdMap.get(h);
|
|
|
+ // if (f != null) {
|
|
|
+ // f.displayTime = Date.now(),
|
|
|
+ // f.status = 3;
|
|
|
+ // const d = f.receiveTime - f.startTime
|
|
|
+ // , _ = f.readyTime - f.receiveTime
|
|
|
+ // , g = f.displayTime - f.readyTime
|
|
|
+ // , m = f.displayTime - f.startTime;
|
|
|
+ // this.responseTimeArray.push(d),
|
|
|
+ // this.processTimeArray.push(_),
|
|
|
+ // this.displayTimeArray.push(g),
|
|
|
+ // this.overallTimeArray.push(m),
|
|
|
+ // this.traceIdMap.delete(h)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // this.cachedPtss[e] == this.moveStartPts && (this.MoveDisplayDelay = Date.now() - this.StartMovingTs)
|
|
|
+ // if (this.inMovingMode) {
|
|
|
+ // const h = Date.now()
|
|
|
+ // , f = h - this.lastMoveDisplayTime;
|
|
|
+ // this.moveDisplayCircular.add(f),
|
|
|
+ // this.lastMoveDisplayTime = h
|
|
|
+ // }
|
|
|
this.executeFunction("signal", {
|
|
|
signal: this.cachedMetas[e],
|
|
|
pts: this.cachedPtss[e],
|
|
|
alreadyUpdateYUV: !0
|
|
|
- }),
|
|
|
- this.cachedRender[e] = !0,
|
|
|
+ })
|
|
|
+ this.cachedRender[e] = !0;
|
|
|
this.getPtr = (this.getPtr + 1) % this.cachedLength
|
|
|
}
|
|
|
}
|
|
@@ -1009,17 +1020,25 @@ export default class Workers {
|
|
|
defaultLogger.debug("hhh")
|
|
|
}
|
|
|
dataHandle(e) {
|
|
|
- this.saveframe && (this.decoderWorker.postMessage({
|
|
|
- t: 6
|
|
|
- }),
|
|
|
- this.saveframe = !1),
|
|
|
- this.SaveMediaStream && (this.decoderWorker.postMessage({
|
|
|
- t: 7
|
|
|
- }),
|
|
|
- this.SaveMediaStream = !1);
|
|
|
+ if(this.saveframe){
|
|
|
+ this.decoderWorker.postMessage({
|
|
|
+ t: 6
|
|
|
+ }),
|
|
|
+ this.saveframe = !1
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.SaveMediaStream){
|
|
|
+ this.decoderWorker.postMessage({
|
|
|
+ t: 7
|
|
|
+ }),
|
|
|
+ this.SaveMediaStream = !1
|
|
|
+ }
|
|
|
+
|
|
|
const t = new Uint8Array(e);
|
|
|
if (t.length >= 4 && this.isHeartBeatPacket(t.buffer, t.length) == !0)
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
if (t.length > 36 && this.unmarshalStream(t.buffer) == !0) {
|
|
|
if(this.reconnectSignal){
|
|
|
this.executeFunction("reconnectedFrame", {});
|
|
@@ -1028,7 +1047,9 @@ export default class Workers {
|
|
|
return
|
|
|
}
|
|
|
if (t.length > 20 && this.unmarshalPano(t.buffer) == !0)
|
|
|
+ {
|
|
|
return;
|
|
|
+ }
|
|
|
this.noWasmBytesReceived += e.byteLength;
|
|
|
const r = JSON.parse(this.Stringify(t));
|
|
|
this.executeFunction("signal", {
|