| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467 |
- class Workers {
- constructor(o, s) {
- (this.rtcp = o),
- (this.cacheSize = 0),
- (this.cacheBuffer = new Uint8Array(262144)),
- (this.cacheFrameCnt = 0),
- (this.startReceiveTime = 0),
- (this.cacheFrameComposes = new Array(0)),
- (this.cacheSizes = new Array(5).fill(0)),
- (this.cacheFrameCnts = new Array(5).fill(-1)),
- (this.cacheStartReceiveTimes = new Array(5).fill(0)),
- (this.cacheBuffers = [
- new Uint8Array(262144),
- new Uint8Array(262144),
- new Uint8Array(262144),
- new Uint8Array(262144),
- new Uint8Array(262144),
- ]),
- (this.panoCacheSize = 0),
- (this.panoCacheBuffer = new Uint8Array(2097152)),
- (this.cachePanoTileID = 0),
- (this.receivedMedia = 0),
- (this.receivedMedia_worker = 0),
- (this.receivedYUV = 0),
- (this.receivedEmit = 0),
- (this.returnFrames = 0),
- (this.lastReturnFrames = 0),
- (this.lastReceivedEmit = 0),
- (this.mediaBytesReceived = 0),
- (this.metaBytesReceived = 0),
- (this.noWasmBytesReceived = 0),
- (this.rtcBytesReceived = 0),
- (this.rtcMessageReceived = 0),
- (this.packetsDrop = 0),
- (this.framesAwait = 0),
- (this.sendOutBuffer = 0),
- (this.decodeTimePerFrame = 0),
- (this.decodeTimeMaxFrame = 0),
- (this.lastRenderTs = 0),
- (this.JankTimes = 0),
- (this.bigJankTimes = 0),
- (this.DecodeJankTimes = 0),
- (this.bigDecodeJankTimes = 0),
- (this.saveframe = !1),
- (this.SaveMediaStream = !1),
- (this.packetsLost = 0),
- (this.showAllReceivedMetadata = !1),
- (this.firstMediaArraval = 0),
- (this.firstMediaReceived = !1),
- (this.firstYUVDecoded = 0),
- (this.firstRender = 0),
- (this.firstYUVReceived = !1),
- (this.reconnectSignal = !1),
- (this.serverFrameSlow = 0),
- (this.serverFrameFast = 0),
- (this.clientFrameSlow = 0),
- (this.clientFrameFast = 0),
- (this.lastServerTS = 0),
- (this.lastClientTS = 0),
- (this.lastSeq = 0),
- (this.lastIsPureMeta = !1),
- (this.lastHBPacketTs = 0),
- (this.HBPacketInterval = 0),
- (this.lastHBPacketSrvSentTs = 0),
- (this.HBPacketIntervalSrvSent = 0),
- (this.cachedLength = 5),
- (this.cachedStreams = new Array(this.cachedLength)),
- (this.cachedMetas = new Array(this.cachedLength)),
- (this.cachedPtss = new Array(this.cachedLength)),
- (this.cachedRender = Array(this.cachedLength).fill(!1)),
- (this.cachedResolution = new Array(this.cachedLength)),
- (this.getPtr = 0),
- (this.setPtr = 0),
- (this.receiveIframes = 0),
- (this.decodeIframes = 0),
- (this.prevSenderTs = -1),
- (this.serverSendTimeArray = new CircularArray(120, !1, [])),
- (this.inPanoMode = !1),
- (this.PanoStatus = { x: 0, y: 0, z: 0, tiles: [] }),
- (this.DynamicPanoTest = !1),
- (this.PanoMask = new ArrayBuffer(8)),
- (this.PanoView = new DataView(this.PanoMask)),
- (this.userId_test = ""),
- (this.PendingMasks = []),
- (this.traceIdMap = new Map()),
- (this.responseTimeArray = []),
- (this.processTimeArray = []),
- (this.displayTimeArray = []),
- (this.overallTimeArray = []),
- (this.responseMiss = 0),
- (this.processMiss = 0),
- (this.displayMiss = 0),
- (this.joyStickTraceIdMap = new Map()),
- (this.joyStickResponseTimeArray = []),
- (this.joyStickProcessTimeArray = []),
- (this.joyStickDisplayTimeArray = []),
- (this.joyStickOverallTimeArray = []),
- (this.joyStickResponseMiss = 0),
- (this.joyStickProcessMiss = 0),
- (this.joyStickDisplayMiss = 0),
- (this.updateYUVCircular = new CircularArray(120, !1, [])),
- (this.updateDropFrame = 0),
- (this.metaParseAraay = []),
- (this.responseMoveMiss = 0),
- (this.processMoveMiss = 0),
- (this.displayMoveMiss = 0),
- (this.MovingTraceId = ""),
- (this.PendingMovingTraceId = ""),
- (this.inMovingMode = !1),
- (this.StartMovingTs = 0),
- (this.PendingStartMovingTs = 0),
- (this.moveEvent = ""),
- (this.MoveToFrameCnt = 0),
- (this.lastIsMoving = 0),
- (this.MoveResponseDelay = 0),
- (this.MoveProcessDelay = 0),
- (this.MoveDisplayDelay = 0),
- (this.lastMoveResponseTime = 0),
- (this.lastMoveProcessTime = 0),
- (this.lastMoveDisplayTime = 0),
- (this.moveResponseCircular = new CircularArray(120, !0, [
- STUCK_STAGE_GOOD,
- STUCK_STAGE_WELL,
- STUCK_STAGE_FAIR,
- STUCK_STAGE_BAD,
- ])),
- (this.moveProcessCircular = new CircularArray(120, !0, [
- STUCK_STAGE_GOOD,
- STUCK_STAGE_WELL,
- STUCK_STAGE_FAIR,
- STUCK_STAGE_BAD,
- ])),
- (this.moveDisplayCircular = new CircularArray(120, !0, [
- STUCK_STAGE_GOOD,
- STUCK_STAGE_WELL,
- STUCK_STAGE_FAIR,
- STUCK_STAGE_BAD,
- ])),
- (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.serverHBMax = 0),
- (this.serverHBAvg = 0),
- (this.unmarshalStreamExecutionArray = new SecondArray()),
- (this.receiveYUVExecutionArray = new SecondArray()),
- (this.postMessageWaitArray = new SecondArray()),
- (this.firstUpdateYUV = !0),
- (this.bypasserList = []),
- (this.functionMap = new Map()),
- (this.WASM_VERSION = "WASM-1.1"),
- (this.frameHistory = []),
- (this.getVersion = function () {
- return DECODER_VERSION;
- }),
- (this.downloadBlob = (c, _, b) => {
- const k = new Blob([c], { type: b }),
- j = window.URL.createObjectURL(k);
- this.downloadURL(j, _),
- setTimeout(function () {
- return window.URL.revokeObjectURL(j);
- }, 1e3);
- }),
- (this.downloadURL = function (c, _) {
- const b = document.createElement("a");
- (b.href = c),
- (b.download = _),
- document.body.appendChild(b),
- (b.style.display = "none"),
- b.click(),
- b.remove();
- }),
- (this.Stringify = function (c) {
- let _ = "";
- for (let k = 0; k < c.length / 8192; k++)
- _ += String.fromCharCode.apply(
- null,
- c.slice(k * 8192, (k + 1) * 8192)
- );
- return _;
- }),
- (this._rtcp = o);
- }
- registerLogger(o) {
- log$o = o;
- }
- registerFunction(o, s) {
- this.functionMap.set(o, s);
- }
- hasFrmCntInCache(o) {
- let s = -1;
- for (let c = 0; c < this.cacheFrameComposes.length; c++)
- this.cacheFrameComposes[c].frameCnt == o && (s = c);
- return s;
- }
- requestPanoramaTest(o, s, c, _, b) {
- const k = b,
- j = {
- action_type: 16,
- change_rotation_render_type_action: {
- render_type: 5,
- player: {
- position: { x: 0, y: 0, z: 0 },
- angle: { yaw: 0, pitch: 0, roll: 0 },
- },
- camera: {
- position: { x: o, y: s, z: c },
- angle: { yaw: 0, pitch: 0, roll: 0 },
- },
- client_pano_titles_bitmap: _,
- },
- trace_id: k,
- user_id: this.userId_test,
- packet_id: k,
- };
- log$o.debug("send data: ", j), this._rtcp.sendData(j);
- }
- onRotateInPanoMode(o) {
- const s = o.traceId,
- c = {};
- (c.width = 1280),
- (c.height = 720),
- (c.horz_fov = 92),
- (c.angle = { yaw: 100, pitch: 30 });
- const _ = new ArrayBuffer(8),
- b = new DataView(_);
- getTilesInView(c, _);
- const k = _.slice(0);
- this.PendingMasks.unshift({ buffer: k, angle: c.angle }),
- MaskSetToOne(18, this.PanoView),
- operateForDataView(b, this.PanoView, b, (j, $) => j ^ (j & $)),
- this.requestPanoramaTest(
- 0,
- 0,
- 0,
- [
- b.getUint8(0),
- b.getUint8(1),
- b.getUint8(2),
- b.getUint8(3),
- b.getUint8(4),
- b.getUint8(5),
- b.getUint8(6),
- b.getUint8(7),
- ],
- s
- );
- }
- processMetaWithTraceId(o) {
- for (const s of o.traceIds) {
- if (this.traceIdMap.has(s)) {
- const c = this.traceIdMap.get(s);
- c != null && ((c.receiveTime = Date.now()), (c.status = 1));
- }
- if (this.joyStickTraceIdMap.has(s)) {
- const c = this.joyStickTraceIdMap.get(s);
- c != null && ((c.receiveTime = Date.now()), (c.status = 1));
- }
- if (s == this.PendingMovingTraceId) {
- (this.inMovingMode = !0),
- (this.MovingTraceId = this.PendingMovingTraceId),
- (this.StartMovingTs = this.PendingStartMovingTs),
- (this.PendingMovingTraceId = ""),
- (this.PendingStartMovingTs = 0),
- log$o.info("MoveTo TraceId match", this.StartMovingTs, Date.now());
- const c = Date.now();
- (this.lastMoveResponseTime = c),
- (this.lastMoveProcessTime = c),
- (this.lastMoveDisplayTime = c),
- this.frameServerCircular.clear(),
- this.frameClientCircular.clear();
- }
- }
- }
- onTraceId(o, s = this) {
- const c = o.traceId,
- _ = o.timestamp,
- b = o.event;
- if (b === "Rotation") {
- const k = {
- traceId: c,
- pts: 0,
- startTime: _,
- receiveTime: 0,
- readyTime: 0,
- displayTime: 0,
- status: 0,
- };
- this.traceIdMap.set(c, k);
- const j = setTimeout(() => {
- if ((j && clearTimeout(j), this.traceIdMap.has(c))) {
- const $ = this.traceIdMap.get(c);
- switch ($ == null ? void 0 : $.status) {
- case 0: {
- this.responseMiss += 1;
- break;
- }
- case 1: {
- this.processMiss += 1;
- const _e = $.receiveTime - $.startTime;
- this.responseTimeArray.push(_e);
- break;
- }
- case 2: {
- this.displayMiss += 1;
- const _e = $.receiveTime - $.startTime,
- et = $.readyTime - $.receiveTime;
- this.responseTimeArray.push(_e), this.processTimeArray.push(et);
- break;
- }
- case 3:
- log$o.debug("status is 3");
- }
- }
- }, 1e3);
- } else if (b === "Joystick") {
- const k = {
- traceId: c,
- pts: 0,
- startTime: _,
- receiveTime: 0,
- readyTime: 0,
- displayTime: 0,
- status: 0,
- };
- this.joyStickTraceIdMap.set(c, k);
- const j = setTimeout(() => {
- if ((j && clearTimeout(j), this.joyStickTraceIdMap.has(c))) {
- const $ = this.joyStickTraceIdMap.get(c);
- switch ($ == null ? void 0 : $.status) {
- case 0: {
- this.joyStickResponseMiss += 1;
- break;
- }
- case 1: {
- this.joyStickProcessMiss += 1;
- const _e = $.receiveTime - $.startTime;
- this.joyStickResponseTimeArray.push(_e);
- break;
- }
- case 2: {
- this.joyStickDisplayMiss += 1;
- const _e = $.receiveTime - $.startTime,
- et = $.readyTime - $.receiveTime;
- this.joyStickResponseTimeArray.push(_e),
- this.joyStickProcessTimeArray.push(et);
- break;
- }
- case 3:
- log$o.debug("status is 3");
- }
- }
- }, 1e3);
- } else
- b === "MoveTo"
- ? (log$o.info("receive moveto traceId ", c, " at timestamp", _),
- (this.PendingMovingTraceId = c),
- (this.PendingStartMovingTs = _),
- (this.moveEvent = b),
- this.frameServerCircular.clear())
- : b === "GetOnAirship" || b === "GetOnVehicle"
- ? (log$o.info("receive airship traceId ", c, " at timestamp ", _),
- (this.PendingMovingTraceId = c),
- (this.PendingStartMovingTs = _),
- (this.moveEvent = b),
- this.frameServerCircular.clear())
- : (b === "GetOffAirship" || b === "GetOffVehicle") &&
- this.clearMoveArray();
- }
- executeFunction(o, s) {
- if (this.functionMap.has(o)) {
- const c = this.functionMap.get(o);
- c != null && c(s);
- }
- }
- UpdateStats(o) {
- var s;
- (s = this._rtcp.connection) == null ||
- s.getStats(null).then((c) => {
- c.forEach((_) => {
- _.type == "data-channel" &&
- ((this.rtcMessageReceived = _.messagesReceived - _.messagesSent),
- (this.rtcBytesReceived = _.bytesReceived));
- });
- }),
- (this.receivedMedia_worker = o.data.framesReceived),
- (this.receivedYUV = o.data.framesDecoded),
- (this.receivedEmit = o.data.framesRendered),
- (this.mediaBytesReceived = o.data.mediaBytesReceived),
- (this.metaBytesReceived = o.data.metaBytesReceived),
- (this.packetsLost = o.data.packetsLost),
- (this.packetsDrop = o.data.packetsDrop),
- (this.framesAwait = o.data.framesAwait),
- (this.decodeTimePerFrame = o.data.decodeTimePerFrame),
- (this.decodeTimeMaxFrame = o.data.decodeTimeMaxFrame),
- (this.returnFrames = o.data.framesReturned),
- (this.sendOutBuffer = o.data.sendOutBuffer),
- (this.DecodeJankTimes = o.data.JankTimes),
- (this.bigDecodeJankTimes = o.data.bigJankTimes),
- (this.receiveIframes = o.data.receivedIframe),
- (this.decodeIframes = o.data.decodedIframe);
- }
- ReceiveDecodeMessage(o) {
- var $;
- const s = Date.now(),
- c = s - o.data.postTs;
- if ((this.postMessageWaitArray.add(c), !this.firstYUVReceived)) {
- this.firstYUVDecoded = o.data.yuv_ts;
- const _e = this.firstYUVDecoded - this.rtcp.network.room._startTime;
- log$o.infoAndReportMeasurement({
- metric: "firstYUVDecodedAt",
- value: _e,
- group: "joinRoom",
- }),
- (this.firstRender = Date.now());
- const et = this.firstYUVDecoded - this.rtcp.network.room._startTime;
- log$o.infoAndReportMeasurement({
- metric: "firstRenderAt",
- value: et,
- group: "joinRoom",
- }),
- (this.firstYUVReceived = !0),
- (this.lastRenderTs = Date.now());
- }
- !this.cachedRender[this.setPtr] &&
- this.cachedMetas[this.setPtr] != null &&
- (this.cachedStreams[this.setPtr] != null &&
- this.cachedStreams[this.setPtr].byteLength != 0 &&
- (o.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.updateDropFrame += 1),
- 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));
- const _ = o.data.metadata;
- if (($ = _ == null ? void 0 : _.traceIds) != null && $.length)
- for (const _e of _.traceIds) {
- if (this.traceIdMap.has(_e)) {
- const et = this.traceIdMap.get(_e);
- et != null && ((et.readyTime = Date.now()), (et.status = 2));
- }
- if (this.joyStickTraceIdMap.has(_e)) {
- const et = this.joyStickTraceIdMap.get(_e);
- et != null && ((et.readyTime = Date.now()), (et.status = 2));
- }
- }
- if (
- (o.data.pts == this.moveStartPts &&
- (this.MoveProcessDelay = Date.now() - this.StartMovingTs),
- (this.userId_test = this.rtcp.network.room.userId),
- this.inMovingMode)
- ) {
- const _e = Date.now(),
- et = _e - this.lastMoveProcessTime;
- this.moveProcessCircular.add(et), (this.lastMoveProcessTime = _e);
- }
- const b = this.setPtr;
- (this.cachedStreams[b] = o.data.data),
- (this.cachedMetas[b] = o.data.metadata),
- (this.cachedPtss[b] = o.data.pts),
- (this.cachedRender[b] = !1),
- (this.cachedResolution[b] = {
- width: o.data.width,
- height: o.data.height,
- }),
- (this.setPtr = (this.setPtr + 1) % this.cachedLength);
- const j = Date.now() - s;
- this.receiveYUVExecutionArray.add(j);
- }
- SendCacheFrameInfo(o) {
- var tt, rt, it, nt, at, ot, st;
- const s = o.data.cachedKey,
- c = o.data.metadata,
- _ = s,
- b = c,
- k =
- (it =
- (rt =
- (tt = b.newUserStates) == null
- ? void 0
- : tt.find((lt) => lt.userId === this.rtcp.network.room.userId)) ==
- null
- ? void 0
- : rt.playerState) == null
- ? void 0
- : it.roomTypeId,
- j = this.rtcp.network.room.skinId,
- $ =
- (st =
- (ot =
- (at =
- (nt = b.newUserStates) == null
- ? void 0
- : nt.find(
- (lt) => lt.userId === this._rtcp.network.room.userId
- )) == null
- ? void 0
- : at.playerState) == null
- ? void 0
- : ot.player) == null
- ? void 0
- : st.position,
- _e = {
- MsgType: 1,
- FrameCacheMsg: { FrameIndex: _, RoomTypeId: k, SkinID: j, Position: $ },
- };
- let et = "";
- try {
- et = JSON.stringify(_e);
- } catch (lt) {
- log$o.error(lt);
- return;
- }
- }
- ReceivePanoramaDecodeMessage(o) {
- log$o.info("Receive Panorama Image in Workers.ts"),
- MaskSetToOne(o.data.tileId, this.PanoView);
- let s = 0,
- c;
- const _ = this.PendingMasks.length;
- for (s = 0; s < _; s++) {
- const b = this.PendingMasks[s].buffer,
- k = new DataView(b),
- j = new ArrayBuffer(8),
- $ = new DataView(j);
- if (
- (operateForDataView(this.PanoView, k, $, (_e, et) => et ^ (_e & et)),
- IsAll0($))
- ) {
- c = this.PendingMasks[s].angle;
- break;
- }
- }
- for (let b = s; b < _; b++) this.PendingMasks.pop();
- this.executeFunction("panorama", {
- data: o.data.data,
- metadata: o.data.metadata,
- tileId: o.data.tileId,
- finished: !0,
- matchAngle: c,
- });
- }
- enable_decoder_queue_logging() {
- this.decoderWorker.postMessage({ t: 100, status: !0 });
- }
- disable_decoder_queue_logging() {
- this.decoderWorker.postMessage({ t: 100, status: !1 });
- }
- async init(
- o = {
- width: 1280,
- height: 720,
- userID: "testUserId",
- pageSession: "pagesession1",
- serverSession: "serversession1",
- bypasserList: [],
- }
- ) {
- for (let c = 0; c < FRAME_COMPOSE_LENGTH; c++) {
- const _ = {
- buffer: new Uint8Array(262144),
- size: 0,
- startReceiveTime: 0,
- serverTime: 0,
- frameCnt: -1,
- };
- this.cacheFrameComposes.push(_);
- }
- console.log("decoder config is ", o),
- (this.bypasserList = o.bypasserList),
- (USER_ID = o.userID),
- (PAGE_SESSION = o.pageSession),
- (SERVER_SESSION = o.serverSession);
- const s = new Blob([decoder], { type: "application/javascript" });
- return (
- (this.decoderWorker = new Worker(URL.createObjectURL(s))),
- this.decoderWorker.postMessage({
- t: 9,
- url: WASM_URLS[WASM_Version],
- jitterLength: DECODER_PASSIVE_JITTER,
- }),
- this.decoderWorker.postMessage({ t: 1, config: o }),
- new Promise((c) => {
- this.decoderWorker.onmessage = (_) => {
- switch (_.data.t) {
- case 0:
- this.ReceiveDecodeMessage(_);
- break;
- case 1:
- this.UpdateStats(_);
- break;
- case 2:
- c();
- break;
- case 3:
- this.SendCacheFrameInfo(_);
- break;
- case 4: {
- const b = new Date().toISOString(),
- k =
- USER_ID +
- "-" +
- PAGE_SESSION +
- "-" +
- SERVER_SESSION +
- "-" +
- b +
- ".264";
- uploadStream(COS_PREFIX + k, _.data.fileObj);
- break;
- }
- case 5:
- this.executeFunction("signal", {
- signal: _.data.metadata,
- pts: -1,
- alreadyUpdateYUV: !1,
- });
- break;
- case 6:
- log$o.infoAndReportMeasurement(_.data.data),
- log$o.debug("WASM Ready Cost");
- break;
- case 7:
- this.ReceivePanoramaDecodeMessage(_);
- break;
- case 8: {
- const b = { MstType: 0 };
- let k = "";
- try {
- k = JSON.stringify(b);
- } catch ($) {
- log$o.error($);
- return;
- }
- const j = "wasm:" + k;
- this._rtcp.sendStringData(j);
- break;
- }
- case 9: {
- log$o.info(_.data.printMsg);
- break;
- }
- case 10: {
- log$o.error(_.data.printMsg),
- this.executeFunction("error", {
- code: _.data.code,
- message: _.data.printMsg,
- });
- break;
- }
- default:
- log$o.error("Receive unknown message event from decoder"),
- log$o.debug(_.data);
- break;
- }
- };
- })
- );
- }
- setPageSession(o) {
- PAGE_SESSION = o;
- }
- UpdateYUV() {
- var s, c;
- const o = this.getPtr;
- if (this.cachedMetas[o] != null && !this.cachedRender[o]) {
- const _ = Date.now();
- if (this.firstUpdateYUV) {
- const tt =
- ((s = this.cachedStreams[o]) == null ? void 0 : s.byteLength) || 0;
- log$o.infoAndReportMeasurement({
- metric: "firstUpdateStreamLength",
- value: tt,
- group: "joinRoom",
- }),
- (this.firstUpdateYUV = !1);
- }
- this.cachedStreams[o] != null &&
- this.executeFunction("stream", {
- stream: this.cachedStreams[o],
- width: this.cachedResolution[o].width,
- height: this.cachedResolution[o].height,
- pts: this.cachedPtss[o],
- });
- const b = Date.now();
- this.cachedStreams[o] != null &&
- this.decoderWorker.postMessage(
- { t: 2, frameCnt: this.cachedPtss[o], buffer: this.cachedStreams[o] },
- [this.cachedStreams[o].buffer]
- );
- const k = Date.now(),
- j = b - _,
- $ = k - b;
- (j > 33 || $ > 10) &&
- log$o.debug(
- "[wwwarning] updateYUV takes ",
- j,
- " ms, postMessage takes ",
- $,
- " ms for index ",
- this.cachedPtss[o]
- ),
- b - this.lastRenderTs > 84 && this.JankTimes++,
- b - this.lastRenderTs > 125 && this.bigJankTimes++,
- (this.lastRenderTs = b);
- const _e = b - _;
- this.updateYUVCircular.add(_e);
- const et = this.cachedMetas[o];
- if ((c = et == null ? void 0 : et.traceIds) != null && c.length)
- for (const tt of et.traceIds) {
- if (this.traceIdMap.has(tt)) {
- const rt = this.traceIdMap.get(tt);
- if (rt != null) {
- (rt.displayTime = Date.now()), (rt.status = 3);
- const it = rt.receiveTime - rt.startTime,
- nt = rt.readyTime - rt.receiveTime,
- at = rt.displayTime - rt.readyTime,
- ot = rt.displayTime - rt.startTime;
- this.responseTimeArray.push(it),
- this.processTimeArray.push(nt),
- this.displayTimeArray.push(at),
- this.overallTimeArray.push(ot),
- this.traceIdMap.delete(tt);
- }
- }
- if (this.joyStickTraceIdMap.has(tt)) {
- const rt = this.joyStickTraceIdMap.get(tt);
- if (rt != null) {
- (rt.displayTime = Date.now()), (rt.status = 3);
- const it = rt.receiveTime - rt.startTime,
- nt = rt.readyTime - rt.receiveTime,
- at = rt.displayTime - rt.readyTime,
- ot = rt.displayTime - rt.startTime;
- this.joyStickResponseTimeArray.push(it),
- this.joyStickProcessTimeArray.push(nt),
- this.joyStickDisplayTimeArray.push(at),
- this.joyStickOverallTimeArray.push(ot),
- this.joyStickTraceIdMap.delete(tt);
- }
- }
- }
- if (
- (this.cachedPtss[o] == this.moveStartPts &&
- (this.MoveDisplayDelay = Date.now() - this.StartMovingTs),
- this.inMovingMode)
- ) {
- const tt = Date.now(),
- rt = tt - this.lastMoveDisplayTime;
- this.moveDisplayCircular.add(rt), (this.lastMoveDisplayTime = tt);
- }
- this.executeFunction("signal", {
- signal: this.cachedMetas[o],
- pts: this.cachedPtss[o],
- alreadyUpdateYUV: !0,
- }),
- (this.cachedRender[o] = !0),
- (this.getPtr = (this.getPtr + 1) % this.cachedLength);
- }
- }
- unmarshalPano(o) {
- const s = new DataView(o),
- c = s.getUint32(0);
- if (c == 1723558763) return !0;
- if (c != 2296221069) return !1;
- console.log("Receive Pano Message"), s.getUint16(4);
- const _ = s.getUint16(6),
- b = s.getUint32(8),
- k = s.getUint32(12),
- j = s.getUint32(16),
- $ = s.getUint32(20),
- _e = o.byteLength - _;
- if (_e == k) {
- const et = new Uint8Array(o).subarray(_).slice(0, j),
- rt = {
- data: new Uint8Array(o).subarray(_).slice(j, k),
- mediaLen: k - j,
- metadata: et,
- metaLen: j,
- tileId: b,
- };
- this.decoderWorker.postMessage({ t: 8, data: rt });
- } else {
- const et = new Uint8Array(o, _, _e);
- if (this.cachePanoTileID == b) {
- if (
- (this.panoCacheBuffer.set(et, $),
- (this.panoCacheSize += _e),
- this.panoCacheSize === k)
- ) {
- const tt = new Uint8Array(this.panoCacheBuffer).slice(0, j),
- it = {
- data: new Uint8Array(this.panoCacheBuffer).slice(j, k),
- mediaLen: k - j,
- metadata: tt,
- metaLen: j,
- tileId: b,
- };
- this.decoderWorker.postMessage({ t: 8, data: it }),
- (this.panoCacheSize = 0);
- }
- } else
- this.panoCacheBuffer.set(et, $),
- (this.panoCacheSize = _e),
- (this.cachePanoTileID = b);
- }
- return !0;
- }
- clearMoveArray() {
- (this.MovingTraceId = ""),
- (this.inMovingMode = !1),
- (this.StartMovingTs = 0),
- (this.MoveToFrameCnt = 0),
- (this.MoveResponseDelay = 0),
- (this.MoveProcessDelay = 0),
- (this.MoveDisplayDelay = 0),
- (this.moveStartPts = -1),
- this.moveResponseCircular.clear(),
- this.moveProcessCircular.clear(),
- this.moveDisplayCircular.clear(),
- (this.moveEvent = "");
- }
- getIsMoving(o) {
- let s;
- if (typeof o.newUserStates != "undefined")
- for (let c = 0; c < o.newUserStates.length; c++) {
- const _ = o.newUserStates[c];
- if (_.userId == this.rtcp.network.room.userId) {
- s = _.renderInfo.isMoving;
- break;
- }
- }
- return s;
- }
- isHeartBeatPacket(o, s) {
- const c = new DataView(o);
- if (c.getUint32(0) == 2009889916) {
- if (s > 4) {
- const b = c.getUint32(4),
- k = Date.now(),
- j = { MsgType: 2, HBMsg: { SentTs: b, ClientTs: k } };
- let $ = "";
- try {
- $ = JSON.stringify(j);
- } catch (et) {
- log$o.error(et);
- return;
- }
- const _e = "wasm:" + $;
- this._rtcp.sendStringData(_e),
- s > 8 &&
- ((this.serverHBMax = c.getUint32(8)),
- (this.serverHBAvg = c.getUint32(12)));
- }
- return !0;
- } else return !1;
- }
- resetSendTimeDiff() {
- (this.prevSenderTs = 0), this.serverSendTimeArray.clear();
- }
- calcSendTimeDiff(o) {
- if (this.prevSenderTs == -1) {
- this.prevSenderTs = o;
- return;
- }
- const s = o - this.prevSenderTs;
- this.serverSendTimeArray.add(s), (this.prevSenderTs = o);
- }
- unmarshalStream(o) {
- var ft, pt, gt, _t, mt, At, vt, Et, bt, St;
- const s = Date.now(),
- c = new DataView(o);
- if (c.getUint32(0) != 1437227610) return !1;
- c.getUint16(4);
- const b = c.getUint16(6),
- k = c.getUint16(8),
- j = k,
- $ = c.getUint16(10);
- let _e = !1;
- $ == 1 && (_e = !0);
- const et = c.getUint32(12),
- tt = c.getUint32(16),
- rt = c.getUint32(20),
- it = c.getUint16(24),
- nt = c.getUint16(26),
- at = c.getUint32(28),
- ot = c.getUint32(b - 4),
- st = et + tt,
- lt = o.byteLength - b,
- ut = new Uint8Array(o, b, lt);
- this.calcSendTimeDiff(rt);
- let ct;
- if (this.inPanoMode && (tt > 0 || it))
- return (
- log$o.error(
- "Stream Protocal Violation: receive illegal stream in Pano mode"
- ),
- !0
- );
- if (lt === st) {
- this.receivedMedia++;
- const Pt = new Uint8Array(o).subarray(b);
- rt - this.lastServerTS > 60
- ? this.serverFrameSlow++
- : rt - this.lastServerTS < 16 && this.serverFrameFast++;
- const Ct = Date.now();
- Ct - this.lastClientTS > 60
- ? this.clientFrameSlow++
- : Ct - this.lastClientTS < 16 && this.clientFrameFast++;
- const xt = tt === 0,
- Mt = rt - this.lastServerTS;
- this.lastServerTS != 0 &&
- ((k + 65536 - this.lastSeq) % 65536 === 1 &&
- this.lastIsPureMeta == xt &&
- (xt
- ? this.srvMetaIntervalCircular.add(Mt)
- : this.srvMediaIntervalCircular.add(Mt)),
- this.frameServerCircular.add(Mt),
- this.frameClientCircular.add(Ct - this.lastClientTS)),
- (this.lastSeq = k),
- (this.lastIsPureMeta = xt),
- (this.lastServerTS = rt),
- (this.lastClientTS = Ct);
- const Tt = Pt.subarray(0, et),
- It = Date.now(),
- Ot = JSON.parse(this.Stringify(Tt)),
- Bt = Date.now();
- this.showAllReceivedMetadata && console.log(rt, Ct, Ot),
- this.metaParseAraay.push(Bt - It),
- (ft = Ot.traceIds) != null &&
- ft.length &&
- this.processMetaWithTraceId(Ot),
- tt != 0 &&
- this.moveStartPts == -1 &&
- this.inMovingMode &&
- (this.moveStartPts = k),
- this.moveStartPts == k &&
- ((this.MoveResponseDelay = Date.now() - this.StartMovingTs),
- console.log(
- "move response delay: ",
- k,
- this.moveStartPts,
- this.MoveResponseDelay
- ));
- const wt = this.getIsMoving(Ot);
- if (
- (this.inMovingMode &&
- wt == 0 &&
- this.lastIsMoving == 1 &&
- this.clearMoveArray(),
- typeof wt != "undefined" && (this.lastIsMoving = wt),
- this.inMovingMode)
- ) {
- const Rt = Date.now(),
- Ft = Rt - this.lastMoveResponseTime;
- this.moveResponseCircular.add(Ft), (this.lastMoveResponseTime = Rt);
- }
- (it || nt) &&
- (ct =
- (mt =
- (_t =
- (gt =
- (pt = Ot.newUserStates) == null
- ? void 0
- : pt.find(
- (Rt) => Rt.userId === this._rtcp.network.room.userId
- )) == null
- ? void 0
- : gt.playerState) == null
- ? void 0
- : _t.player) == null
- ? void 0
- : mt.position);
- const Dt = {
- t: 0,
- data: Pt,
- mediaLen: tt,
- metaLen: et,
- metadata: Ot,
- frameCnt: j,
- server_ts: rt,
- isIDR: _e,
- cacheRequest: nt,
- cached: it,
- cachedKey: at,
- position: ct,
- };
- if (this.inPanoMode)
- return (
- this.executeFunction("signal", {
- signal: Ot,
- pts: -1,
- alreadyUpdateYUV: !0,
- }),
- !0
- );
- if (
- (this.decoderWorker.postMessage(Dt, [Pt.buffer]),
- !this.firstMediaReceived)
- ) {
- this.firstMediaArraval = Date.now();
- const Rt = this.firstMediaArraval - this.rtcp.network.room._startTime;
- log$o.infoAndReportMeasurement({
- metric: "firstMediaArravalAt",
- value: Rt,
- group: "joinRoom",
- }),
- (this.firstMediaReceived = !0);
- }
- } else {
- const Pt = this.hasFrmCntInCache(j);
- if (Pt != -1)
- if (
- (this.cacheFrameComposes[Pt].buffer.set(ut, ot),
- (this.cacheFrameComposes[Pt].size += lt),
- this.cacheFrameComposes[Pt].size === st)
- ) {
- const Ct = new Uint8Array(this.cacheFrameComposes[Pt].buffer).slice(
- 0,
- st
- );
- (this.cacheFrameComposes[Pt].frameCnt = -1),
- (this.cacheFrameComposes[Pt].size = 0),
- (this.cacheFrameComposes[Pt].startReceiveTime = 0),
- (this.cacheFrameComposes[Pt].serverTime = 0),
- this.receivedMedia++,
- rt - this.lastServerTS > 60
- ? this.serverFrameSlow++
- : rt - this.lastServerTS < 16 && this.serverFrameFast++;
- const xt = Date.now();
- xt - this.lastClientTS > 60
- ? this.clientFrameSlow++
- : xt - this.lastClientTS < 16 && this.clientFrameFast++,
- this.lastServerTS != 0 &&
- (this.frameServerCircular.add(rt - this.lastServerTS),
- this.frameClientCircular.add(xt - this.lastClientTS)),
- (this.lastServerTS = rt),
- (this.lastClientTS = xt);
- const Mt = Ct.subarray(0, et),
- Tt = Date.now(),
- It = JSON.parse(this.Stringify(Mt)),
- Ot = Date.now();
- this.showAllReceivedMetadata && console.log(rt, xt, It),
- this.metaParseAraay.push(Ot - Tt),
- (At = It.traceIds) != null &&
- At.length &&
- this.processMetaWithTraceId(It),
- tt != 0 &&
- this.moveStartPts == -1 &&
- this.inMovingMode &&
- (this.moveStartPts = k),
- this.moveStartPts == k &&
- (this.MoveResponseDelay = Date.now() - this.StartMovingTs);
- const Bt = this.getIsMoving(It);
- if (
- (this.inMovingMode &&
- Bt == 0 &&
- this.lastIsMoving == 1 &&
- this.clearMoveArray(),
- typeof Bt != "undefined" && (this.lastIsMoving = Bt),
- this.inMovingMode)
- ) {
- const Dt = Date.now(),
- Rt = Dt - this.lastMoveResponseTime;
- this.moveResponseCircular.add(Rt), (this.lastMoveResponseTime = Dt);
- }
- (it || nt) &&
- (ct =
- (St =
- (bt =
- (Et =
- (vt = It.newUserStates) == null
- ? void 0
- : vt.find(
- (Dt) => Dt.userId === this._rtcp.network.room.userId
- )) == null
- ? void 0
- : Et.playerState) == null
- ? void 0
- : bt.player) == null
- ? void 0
- : St.position);
- const wt = {
- t: 0,
- data: Ct,
- mediaLen: tt,
- metaLen: et,
- metadata: It,
- frameCnt: j,
- server_ts: rt,
- isIDR: _e,
- cacheRequest: nt,
- cached: it,
- cachedKey: at,
- position: ct,
- };
- if (this.inPanoMode)
- return (
- this.executeFunction("signal", {
- signal: It,
- pts: -1,
- alreadyUpdateYUV: !0,
- }),
- !0
- );
- if (
- (this.decoderWorker.postMessage(wt, [Ct.buffer]),
- !this.firstMediaReceived)
- ) {
- this.firstMediaArraval = Date.now();
- const Dt =
- this.firstMediaArraval - this.rtcp.network.room._startTime;
- log$o.infoAndReportMeasurement({
- metric: "firstMediaArravalAt",
- value: Dt,
- group: "joinRoom",
- }),
- (this.firstMediaReceived = !0);
- }
- } else
- this.cacheFrameComposes[Pt].size > st &&
- log$o.debug(
- "I frame exceed, cache size is ",
- this.cacheSize,
- ", total size is ",
- st
- );
- else if (Pt == -1) {
- let Ct = this.hasFrmCntInCache(-1);
- if (Ct == -1) {
- let xt = Date.now() + 1e18,
- Mt = -1;
- for (let Tt = 0; Tt < this.cacheFrameComposes.length; Tt++)
- this.cacheFrameComposes[Tt].serverTime < xt &&
- ((xt = this.cacheFrameComposes[Tt].serverTime), (Mt = Tt));
- Ct = Mt;
- }
- this.cacheFrameComposes[Ct].buffer.set(ut, ot),
- (this.cacheFrameComposes[Ct].size = lt),
- (this.cacheFrameComposes[Ct].frameCnt = j),
- (this.cacheFrameComposes[Ct].startReceiveTime = Date.now()),
- (this.cacheFrameComposes[Ct].serverTime = rt);
- }
- }
- const dt = Date.now() - s;
- return this.unmarshalStreamExecutionArray.add(dt), !0;
- }
- reset() {
- log$o.debug("Worker reset is called"),
- (this.cacheFrameCnt = 0),
- (this.receivedMedia = 0),
- (this.reconnectSignal = !0),
- this.decoderWorker.postMessage({ t: 4 });
- }
- dataHandleOff(o) {
- log$o.debug("hhh");
- }
- dataHandle(o) {
- this.saveframe &&
- (this.decoderWorker.postMessage({ t: 6 }), (this.saveframe = !1)),
- this.SaveMediaStream &&
- (this.decoderWorker.postMessage({ t: 7 }), (this.SaveMediaStream = !1));
- const s = new Uint8Array(o);
- if (s.length >= 4 && this.isHeartBeatPacket(s.buffer, s.length) == !0)
- return;
- if (s.length > 36 && this.unmarshalStream(s.buffer) == !0) {
- this.reconnectSignal &&
- (this.executeFunction("reconnectedFrame", {}),
- (this.reconnectSignal = !1));
- return;
- }
- if (s.length > 20 && this.unmarshalPano(s.buffer) == !0) return;
- this.noWasmBytesReceived += o.byteLength;
- const c = JSON.parse(this.Stringify(s));
- this.executeFunction("signal", {
- signal: c,
- pts: -1,
- alreadyUpdateYUV: !0,
- });
- }
- changePanoMode(o) {
- this.inPanoMode = o;
- }
- uploadDataToServer() {
- this.DynamicPanoTest == !0 &&
- (this.onRotateInPanoMode({
- traceId: "b2e1a296-6438-4371-8a31-687beb724ebe",
- }),
- (this.DynamicPanoTest = !1));
- function o(cr, ur) {
- return ur == -1 && (ur = 0), cr + ur;
- }
- function s(cr, ur) {
- return Math.max(cr, ur);
- }
- const c =
- this.responseTimeArray.reduce(o, 0) / this.responseTimeArray.length ||
- 0,
- _ =
- this.processTimeArray.reduce(o, 0) / this.processTimeArray.length || 0,
- b =
- this.displayTimeArray.reduce(o, 0) / this.displayTimeArray.length || 0,
- k =
- this.overallTimeArray.reduce(o, 0) / this.overallTimeArray.length || 0,
- j = this.overallTimeArray.length;
- (this.responseTimeArray = []),
- (this.processTimeArray = []),
- (this.displayTimeArray = []),
- (this.overallTimeArray = []);
- const $ =
- this.joyStickResponseTimeArray.reduce(o, 0) /
- this.joyStickResponseTimeArray.length || 0,
- _e =
- this.joyStickProcessTimeArray.reduce(o, 0) /
- this.joyStickProcessTimeArray.length || 0,
- et =
- this.joyStickDisplayTimeArray.reduce(o, 0) /
- this.joyStickDisplayTimeArray.length || 0,
- tt =
- this.joyStickOverallTimeArray.reduce(o, 0) /
- this.joyStickOverallTimeArray.length || 0,
- rt = this.joyStickResponseTimeArray.reduce(s, 0),
- it = this.joyStickProcessTimeArray.reduce(s, 0),
- nt = this.joyStickDisplayTimeArray.reduce(s, 0),
- at = this.joyStickOverallTimeArray.reduce(s, 0);
- (this.joyStickResponseTimeArray = []),
- (this.joyStickProcessTimeArray = []),
- (this.joyStickDisplayTimeArray = []),
- (this.joyStickOverallTimeArray = []);
- const ot = this.moveResponseCircular.getThreshPercent(),
- st = ot[0],
- lt = ot[1],
- ut = ot[2],
- ct = ot[3],
- ht = ot[4],
- dt = ht - ct,
- ft = 1 - lt / ht || 0,
- pt = [st, lt - st, ut - lt, ct - ut, dt],
- gt = this.moveProcessCircular.getThreshPercent(),
- _t = gt[0],
- mt = gt[1],
- At = gt[2],
- vt = gt[3],
- Et = gt[4],
- bt = Et - vt,
- St = 1 - mt / Et || 0,
- Pt = [_t, mt - _t, At - mt, vt - At, bt],
- Ct = this.moveDisplayCircular.getThreshPercent(),
- xt = Ct[0],
- Mt = Ct[1],
- Tt = Ct[2],
- It = Ct[3],
- Ot = Ct[4],
- Bt = Ot - It,
- wt = 1 - Mt / Ot || 0,
- Dt = [xt, Mt - xt, Tt - Mt, It - Tt, Bt],
- Rt = xt,
- Ft = Mt - xt,
- Nt = Tt - Mt,
- Lt = It - Tt,
- Ut = Bt,
- zt = this.moveResponseCircular.getAvg(),
- Gt = this.moveProcessCircular.getAvg(),
- Ht = this.moveDisplayCircular.getAvg(),
- Vt = this.moveResponseCircular.getMax(),
- Wt = this.moveProcessCircular.getMax(),
- Xt = this.moveDisplayCircular.getMax(),
- $t = this.moveResponseCircular.getStandardDeviation(),
- jt = this.moveProcessCircular.getStandardDeviation(),
- Yt = this.moveDisplayCircular.getStandardDeviation();
- this.moveResponseCircular.getIncomingAvg(),
- this.moveProcessCircular.getIncomingAvg(),
- this.moveDisplayCircular.getIncomingAvg(),
- this.moveResponseCircular.getIncomingMax(),
- this.moveProcessCircular.getIncomingMax(),
- this.moveDisplayCircular.getIncomingMax(),
- this.moveResponseCircular.clearIncoming(),
- this.moveProcessCircular.clearIncoming(),
- this.moveDisplayCircular.clearIncoming();
- const er = this.frameServerCircular.getAvg(),
- rr = this.frameServerCircular.getMax();
- this.frameClientCircular.getAvg(), this.frameClientCircular.getMax();
- const ir =
- this.metaParseAraay.reduce(o, 0) / this.metaParseAraay.length || 0,
- tr = this.metaParseAraay.reduce(s, 0);
- this.metaParseAraay = [];
- const or = this.unmarshalStreamExecutionArray.getStat(),
- Jt = this.receiveYUVExecutionArray.getStat(),
- Zt = this.postMessageWaitArray.getStat().max,
- lr = {
- mediaBytesReceived: this.mediaBytesReceived,
- metaBytesReceived: this.metaBytesReceived,
- packetsLost: this.packetsLost,
- timestamp: Date.now(),
- frameHeight: 1280,
- frameWidth: 720,
- framesReceived: this.receivedMedia,
- framesReceivedWorker: this.receivedMedia_worker,
- framesDecoded: this.receivedYUV,
- framesEmited: this.receivedEmit,
- decodeTimePerFrame: this.decodeTimePerFrame,
- decodeTimeMaxFrame: this.decodeTimeMaxFrame,
- packetsDrop: this.packetsDrop,
- framesAwait: this.framesAwait,
- firstMediaArraval: this.firstMediaArraval,
- firstYUVDecoded: this.firstYUVDecoded,
- firstRender: this.firstRender,
- returnFrames: this.returnFrames,
- sendOutBuffer: this.sendOutBuffer,
- maxGraphicTime: this.updateYUVCircular.getMax(),
- averageGraphicTime: this.updateYUVCircular.getAvg(),
- jankTimes: this.JankTimes,
- bigJankTimes: this.bigJankTimes,
- decodeJankTimes: this.DecodeJankTimes,
- bigDecodeJankTimes: this.bigDecodeJankTimes,
- serverFrameSlow: this.serverFrameSlow,
- serverFrameFast: this.serverFrameFast,
- clientFrameSlow: this.clientFrameSlow,
- clientFrameFast: this.clientFrameFast,
- rtcMessageReceived: this.rtcMessageReceived,
- rtcBytesReceived: this.rtcBytesReceived - this.noWasmBytesReceived,
- noWasmBytesReceived: this.noWasmBytesReceived,
- receiveIframes: this.receiveIframes,
- decodeIframes: this.decodeIframes,
- avgResponseTime: c,
- avgProcessTime: _,
- avgDisplayTime: b,
- avgOverallTime: k,
- overallTimeCount: j,
- responseMiss: this.responseMiss,
- processMiss: this.processMiss,
- displayMiss: this.displayMiss,
- updateDropFrame: this.updateDropFrame,
- moveEvent: this.moveEvent,
- avgResponseMoveDiff: this.moveEvent == "MoveTo" ? zt : 0,
- avgProcessMoveDiff: this.moveEvent == "MoveTo" ? Gt : 0,
- avgDisplayMoveDiff: this.moveEvent == "MoveTo" ? Ht : 0,
- maxResponseMoveDiff: this.moveEvent == "MoveTo" ? Vt : 0,
- maxProcessMoveDiff: this.moveEvent == "MoveTo" ? Wt : 0,
- maxDisplayMoveDiff: this.moveEvent == "MoveTo" ? Xt : 0,
- moveResponseJank: this.moveEvent == "MoveTo" ? ft : 0,
- moveProcessJank: this.moveEvent == "MoveTo" ? St : 0,
- moveDisplayJank: this.moveEvent == "MoveTo" ? wt : 0,
- moveResponseCounts:
- this.moveEvent == "MoveTo" ? pt.toString() : "0,0,0,0,0",
- moveProcessCounts:
- this.moveEvent == "MoveTo" ? Pt.toString() : "0,0,0,0,0",
- moveDisplayCounts:
- this.moveEvent == "MoveTo" ? Dt.toString() : "0,0,0,0,0",
- MoveDisplayCountGood: this.moveEvent == "MoveTo" ? Rt.toString() : "0",
- MoveDisplayCountWell: this.moveEvent == "MoveTo" ? Ft.toString() : "0",
- MoveDisplayCountFair: this.moveEvent == "MoveTo" ? Nt.toString() : "0",
- MoveDisplayCountBad: this.moveEvent == "MoveTo" ? Lt.toString() : "0",
- MoveDisplayCountRest: this.moveEvent == "MoveTo" ? Ut.toString() : "0",
- moveResponseDelay:
- this.moveEvent == "MoveTo" ? this.MoveResponseDelay : 0,
- moveProcessDelay:
- this.moveEvent == "MoveTo" ? this.MoveProcessDelay : 0,
- moveDisplayDelay:
- this.moveEvent == "MoveTo" ? this.MoveDisplayDelay : 0,
- sdMoveResponseLongTime: $t,
- sdMoveProcessLongTime: jt,
- sdMoveDisplayLongTime: Yt,
- avgResponseFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? zt
- : 0,
- avgProcessFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Gt
- : 0,
- avgDisplayFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Ht
- : 0,
- maxResponseFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Vt
- : 0,
- maxProcessFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Wt
- : 0,
- maxDisplayFlyDiff:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Xt
- : 0,
- flyResponseJank:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? ft
- : 0,
- flyProcessJank:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? St
- : 0,
- flyDisplayJank:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? wt
- : 0,
- flyResponseCounts:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? pt.toString()
- : "0,0,0,0,0",
- flyProcessCounts:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Pt.toString()
- : "0,0,0,0,0",
- flyDisplayCounts:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? Dt.toString()
- : "0,0,0,0,0",
- flyResponseDelay:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? this.MoveResponseDelay
- : 0,
- flyProcessDelay:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? this.MoveProcessDelay
- : 0,
- flyDisplayDelay:
- this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship"
- ? this.MoveDisplayDelay
- : 0,
- avgMetaParseTime: ir,
- maxMetaParseTime: tr,
- avgServerDiff: er,
- maxServerDiff: rr,
- unmarshalStreamStat: or,
- receiveYUVStat: Jt,
- maxPostMsgDiff: Zt,
- serverHBMax: this.serverHBMax,
- serverHBAvg: this.serverHBAvg,
- streamType: WASM_Version,
- avgJoyStickResponseTime: $,
- avgJoyStickProcessTime: _e,
- avgJoyStickDisplayTime: et,
- avgJoyStickOverallTime: tt,
- maxJoyStickResponseTime: rt,
- maxJoyStickProcessTime: it,
- maxJoyStickDisplayTime: nt,
- maxJoyStickOverallTime: at,
- };
- return (
- (this.lastReturnFrames = this.returnFrames),
- (this.lastReceivedEmit = this.receivedEmit),
- lr
- );
- }
- }
|