Workers.js 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. let log$m = defaultLogger;
  2. const USER_ID = "987412365"
  3. , PAGE_SESSION = "aaabbbccc"
  4. , SERVER_SESSION = "cccbbbaaa"
  5. , COS_PREFIX = "error-bitstreams-auto-uploaded-from-application/"
  6. , FRAME_COMPOSE_LENGTH = 5;
  7. class Workers {
  8. constructor(e, t) {
  9. this.rtcp = e,
  10. this.cacheSize = 0,
  11. this.cacheBuffer = new Uint8Array(262144),
  12. this.cacheFrameCnt = 0,
  13. this.startReceiveTime = 0,
  14. this.cacheFrameComposes = new Array(0),
  15. this.cacheSizes = new Array(5).fill(0),
  16. this.cacheFrameCnts = new Array(5).fill(-1),
  17. this.cacheStartReceiveTimes = new Array(5).fill(0),
  18. this.cacheBuffers = [new Uint8Array(262144), new Uint8Array(262144), new Uint8Array(262144), new Uint8Array(262144), new Uint8Array(262144)],
  19. this.panoCacheSize = 0,
  20. this.panoCacheBuffer = new Uint8Array(2097152),
  21. this.cachePanoTileID = 0,
  22. this.receivedMedia = 0,
  23. this.receivedMedia_worker = 0,
  24. this.receivedYUV = 0,
  25. this.receivedEmit = 0,
  26. this.returnFrames = 0,
  27. this.lastReturnFrames = 0,
  28. this.lastReceivedEmit = 0,
  29. this.mediaBytesReceived = 0,
  30. this.metaBytesReceived = 0,
  31. this.noWasmBytesReceived = 0,
  32. this.rtcBytesReceived = 0,
  33. this.rtcMessageReceived = 0,
  34. this.packetsDrop = 0,
  35. this.framesAwait = 0,
  36. this.sendOutBuffer = 0,
  37. this.decodeTimePerFrame = 0,
  38. this.decodeTimeMaxFrame = 0,
  39. this.lastRenderTs = 0,
  40. this.JankTimes = 0,
  41. this.bigJankTimes = 0,
  42. this.DecodeJankTimes = 0,
  43. this.bigDecodeJankTimes = 0,
  44. this.saveframe = !1,
  45. this.SaveMediaStream = !1,
  46. this.packetsLost = 0,
  47. this.showAllReceivedMetadata = !1,
  48. this.firstMediaArraval = 0,
  49. this.firstMediaReceived = !1,
  50. this.firstYUVDecoded = 0,
  51. this.firstRender = 0,
  52. this.firstYUVReceived = !1,
  53. this.reconnectSignal = !1,
  54. this.serverFrameSlow = 0,
  55. this.serverFrameFast = 0,
  56. this.clientFrameSlow = 0,
  57. this.clientFrameFast = 0,
  58. this.lastServerTS = 0,
  59. this.lastClientTS = 0,
  60. this.lastSeq = 0,
  61. this.lastIsPureMeta = !1,
  62. this.lastHBPacketTs = 0,
  63. this.HBPacketInterval = 0,
  64. this.lastHBPacketSrvSentTs = 0,
  65. this.HBPacketIntervalSrvSent = 0,
  66. this.cachedLength = 2,
  67. this.cachedStreams = new Array(this.cachedLength),
  68. this.cachedMetas = new Array(this.cachedLength),
  69. this.cachedPtss = new Array(this.cachedLength),
  70. this.cachedRender = Array(this.cachedLength).fill(!1),
  71. this.cachedResolution = new Array(this.cachedLength),
  72. this.getPtr = 0,
  73. this.setPtr = 0,
  74. this.receiveIframes = 0,
  75. this.decodeIframes = 0,
  76. this.prevSenderTs = -1,
  77. this.serverSendTimeArray = new CircularArray(120,!1,[]),
  78. this.inPanoMode = !1,
  79. this.PanoStatus = {
  80. x: 0,
  81. y: 0,
  82. z: 0,
  83. tiles: []
  84. },
  85. this.DynamicPanoTest = !1,
  86. this.PanoMask = new ArrayBuffer(8),
  87. this.PanoView = new DataView(this.PanoMask),
  88. this.userId_test = "",
  89. this.PendingMasks = [],
  90. this.traceIdMap = new Map,
  91. this.responseTimeArray = [],
  92. this.processTimeArray = [],
  93. this.displayTimeArray = [],
  94. this.overallTimeArray = [],
  95. this.responseMiss = 0,
  96. this.processMiss = 0,
  97. this.displayMiss = 0,
  98. this.updateYUVCircular = new CircularArray(120,!1,[]),
  99. this.updateDropFrame = 0,
  100. this.metaParseAraay = [],
  101. this.responseMoveMiss = 0,
  102. this.processMoveMiss = 0,
  103. this.displayMoveMiss = 0,
  104. this.MovingTraceId = "",
  105. this.PendingMovingTraceId = "",
  106. this.inMovingMode = !1,
  107. this.StartMovingTs = 0,
  108. this.PendingStartMovingTs = 0,
  109. this.moveEvent = "",
  110. this.MoveToFrameCnt = 0,
  111. this.lastIsMoving = 0,
  112. this.MoveResponseDelay = 0,
  113. this.MoveProcessDelay = 0,
  114. this.MoveDisplayDelay = 0,
  115. this.lastMoveResponseTime = 0,
  116. this.lastMoveProcessTime = 0,
  117. this.lastMoveDisplayTime = 0,
  118. this.moveResponseCircular = new CircularArray(120,!0,[STUCK_STAGE_GOOD, STUCK_STAGE_WELL, STUCK_STAGE_FAIR, STUCK_STAGE_BAD]),
  119. this.moveProcessCircular = new CircularArray(120,!0,[STUCK_STAGE_GOOD, STUCK_STAGE_WELL, STUCK_STAGE_FAIR, STUCK_STAGE_BAD]),
  120. this.moveDisplayCircular = new CircularArray(120,!0,[STUCK_STAGE_GOOD, STUCK_STAGE_WELL, STUCK_STAGE_FAIR, STUCK_STAGE_BAD]),
  121. this.moveStartPts = -1,
  122. this.frameServerCircular = new CircularArray(120,!1,[]),
  123. this.srvMetaIntervalCircular = new CircularArray(120,!1,[]),
  124. this.srvMediaIntervalCircular = new CircularArray(120,!1,[]),
  125. this.srvHBMetaIntervalCircular = new CircularArray(120,!1,[]),
  126. this.srvHBMetaIntervalSrvSentCircular = new CircularArray(120,!1,[]),
  127. this.frameClientCircular = new CircularArray(120,!1,[]),
  128. this.firstUpdateYUV = !0,
  129. this.functionMap = new Map,
  130. this.WASM_VERSION = "WASM-1.1",
  131. this.frameHistory = [],
  132. this.getVersion = function() {
  133. return DECODER_VERSION
  134. }
  135. ,
  136. this.downloadBlob = (r,n,o)=>{
  137. const a = new Blob([r],{
  138. type: o
  139. })
  140. , s = window.URL.createObjectURL(a);
  141. this.downloadURL(s, n),
  142. setTimeout(function() {
  143. return window.URL.revokeObjectURL(s)
  144. }, 1e3)
  145. }
  146. ,
  147. this.downloadURL = function(r, n) {
  148. const o = document.createElement("a");
  149. o.href = r,
  150. o.download = n,
  151. document.body.appendChild(o),
  152. o.style.display = "none",
  153. o.click(),
  154. o.remove()
  155. }
  156. ,
  157. this.Stringify = function(r) {
  158. let n = "";
  159. for (let a = 0; a < r.length / 8192; a++)
  160. n += String.fromCharCode.apply(null, r.slice(a * 8192, (a + 1) * 8192));
  161. return n
  162. }
  163. ,
  164. this._rtcp = e
  165. }
  166. registerLogger(e) {
  167. log$m = e
  168. }
  169. registerFunction(e, t) {
  170. this.functionMap.set(e, t)
  171. }
  172. hasFrmCntInCache(e) {
  173. let t = -1;
  174. for (let r = 0; r < this.cacheFrameComposes.length; r++)
  175. this.cacheFrameComposes[r].frameCnt == e && (t = r);
  176. return t
  177. }
  178. requestPanoramaTest(e, t, r, n, o) {
  179. const a = o
  180. , s = {
  181. action_type: 16,
  182. change_rotation_render_type_action: {
  183. render_type: 5,
  184. player: {
  185. position: {
  186. x: 0,
  187. y: 0,
  188. z: 0
  189. },
  190. angle: {
  191. yaw: 0,
  192. pitch: 0,
  193. roll: 0
  194. }
  195. },
  196. camera: {
  197. position: {
  198. x: e,
  199. y: t,
  200. z: r
  201. },
  202. angle: {
  203. yaw: 0,
  204. pitch: 0,
  205. roll: 0
  206. }
  207. },
  208. client_pano_titles_bitmap: n
  209. },
  210. trace_id: a,
  211. user_id: this.userId_test,
  212. packet_id: a
  213. };
  214. log$m.debug("send data: ", s),
  215. this._rtcp.sendData(s)
  216. }
  217. onRotateInPanoMode(e) {
  218. const t = e.traceId
  219. , r = {};
  220. r.width = 1280,
  221. r.height = 720,
  222. r.horz_fov = 92,
  223. r.angle = {
  224. yaw: 100,
  225. pitch: 30
  226. };
  227. const n = new ArrayBuffer(8)
  228. , o = new DataView(n);
  229. getTilesInView(r, n);
  230. const a = n.slice(0);
  231. this.PendingMasks.unshift({
  232. buffer: a,
  233. angle: r.angle
  234. }),
  235. MaskSetToOne(18, this.PanoView),
  236. operateForDataView(o, this.PanoView, o, (s,l)=>s ^ s & l),
  237. this.requestPanoramaTest(0, 0, 0, [o.getUint8(0), o.getUint8(1), o.getUint8(2), o.getUint8(3), o.getUint8(4), o.getUint8(5), o.getUint8(6), o.getUint8(7)], t)
  238. }
  239. processMetaWithTraceId(e) {
  240. for (const t of e.traceIds) {
  241. if (this.traceIdMap.has(t)) {
  242. const r = this.traceIdMap.get(t);
  243. r != null && (r.receiveTime = Date.now(),
  244. r.status = 1)
  245. }
  246. if (t == this.PendingMovingTraceId) {
  247. this.inMovingMode = !0,
  248. this.MovingTraceId = this.PendingMovingTraceId,
  249. this.StartMovingTs = this.PendingStartMovingTs,
  250. this.PendingMovingTraceId = "",
  251. this.PendingStartMovingTs = 0,
  252. log$m.info("MoveTo TraceId match", this.StartMovingTs, Date.now());
  253. const r = Date.now();
  254. this.lastMoveResponseTime = r,
  255. this.lastMoveProcessTime = r,
  256. this.lastMoveDisplayTime = r,
  257. this.frameServerCircular.clear(),
  258. this.frameClientCircular.clear()
  259. }
  260. }
  261. }
  262. onTraceId(e, t=this) {
  263. const r = e.traceId
  264. , n = e.timestamp
  265. , o = e.event;
  266. if (o === "Rotation") {
  267. const a = {
  268. traceId: r,
  269. pts: 0,
  270. startTime: n,
  271. receiveTime: 0,
  272. readyTime: 0,
  273. displayTime: 0,
  274. status: 0
  275. };
  276. this.traceIdMap.set(r, a);
  277. const s = setTimeout(()=>{
  278. if (s && clearTimeout(s),
  279. this.traceIdMap.has(r)) {
  280. const l = this.traceIdMap.get(r);
  281. switch (l == null ? void 0 : l.status) {
  282. case 0:
  283. {
  284. this.responseMiss += 1;
  285. break
  286. }
  287. case 1:
  288. {
  289. this.processMiss += 1;
  290. const u = l.receiveTime - l.startTime;
  291. this.responseTimeArray.push(u);
  292. break
  293. }
  294. case 2:
  295. {
  296. this.displayMiss += 1;
  297. const u = l.receiveTime - l.startTime
  298. , c = l.readyTime - l.receiveTime;
  299. this.responseTimeArray.push(u),
  300. this.processTimeArray.push(c);
  301. break
  302. }
  303. case 3:
  304. log$m.debug("status is 3")
  305. }
  306. }
  307. }
  308. , 1e3)
  309. } else
  310. o === "MoveTo" ? (log$m.info("receive moveto traceId ", r, " at timestamp", n),
  311. this.PendingMovingTraceId = r,
  312. this.PendingStartMovingTs = n,
  313. this.moveEvent = o,
  314. this.frameServerCircular.clear()) : o === "GetOnAirship" || o === "GetOnVehicle" ? (log$m.info("receive airship traceId ", r, " at timestamp ", n),
  315. this.PendingMovingTraceId = r,
  316. this.PendingStartMovingTs = n,
  317. this.moveEvent = o,
  318. this.frameServerCircular.clear()) : (o === "GetOffAirship" || o === "GetOffVehicle") && this.clearMoveArray()
  319. }
  320. executeFunction(e, t) {
  321. if (this.functionMap.has(e)) {
  322. const r = this.functionMap.get(e);
  323. r != null && r(t)
  324. }
  325. }
  326. UpdateStats(e) {
  327. var t;
  328. (t = this._rtcp.connection) == null || t.getStats(null).then(r=>{
  329. r.forEach(n=>{
  330. n.type == "data-channel" && (this.rtcMessageReceived = n.messagesReceived - n.messagesSent,
  331. this.rtcBytesReceived = n.bytesReceived)
  332. }
  333. )
  334. }
  335. ),
  336. this.receivedMedia_worker = e.data.framesReceived,
  337. this.receivedYUV = e.data.framesDecoded,
  338. this.receivedEmit = e.data.framesRendered,
  339. this.mediaBytesReceived = e.data.mediaBytesReceived,
  340. this.metaBytesReceived = e.data.metaBytesReceived,
  341. this.packetsLost = e.data.packetsLost,
  342. this.packetsDrop = e.data.packetsDrop,
  343. this.framesAwait = e.data.framesAwait,
  344. this.decodeTimePerFrame = e.data.decodeTimePerFrame,
  345. this.decodeTimeMaxFrame = e.data.decodeTimeMaxFrame,
  346. this.returnFrames = e.data.framesReturned,
  347. this.sendOutBuffer = e.data.sendOutBuffer,
  348. this.DecodeJankTimes = e.data.JankTimes,
  349. this.bigDecodeJankTimes = e.data.bigJankTimes,
  350. this.receiveIframes = e.data.receivedIframe,
  351. this.decodeIframes = e.data.decodedIframe
  352. }
  353. ReceiveDecodeMessage(e) {
  354. var n;
  355. if (!this.firstYUVReceived) {
  356. this.firstYUVDecoded = e.data.yuv_ts;
  357. const o = this.firstYUVDecoded - this.rtcp.network.room._startTime;
  358. log$m.infoAndReportMeasurement({
  359. metric: "firstYUVDecodedAt",
  360. value: o,
  361. group: "joinRoom"
  362. }),
  363. this.firstRender = Date.now();
  364. const a = this.firstYUVDecoded - this.rtcp.network.room._startTime;
  365. log$m.infoAndReportMeasurement({
  366. metric: "firstRenderAt",
  367. value: a,
  368. group: "joinRoom"
  369. }),
  370. this.firstYUVReceived = !0,
  371. this.lastRenderTs = Date.now()
  372. }
  373. !this.cachedRender[this.setPtr] && this.cachedMetas[this.setPtr] != null && (this.cachedStreams[this.setPtr] != null && this.cachedStreams[this.setPtr].byteLength != 0 && (e.data.data == null ? (this.executeFunction("stream", {
  374. stream: this.cachedStreams[this.setPtr],
  375. width: this.cachedResolution[this.setPtr].width,
  376. height: this.cachedResolution[this.setPtr].height,
  377. pts: this.cachedPtss[this.setPtr]
  378. }),
  379. this.executeFunction("signal", {
  380. signal: this.cachedMetas[this.setPtr],
  381. pts: this.cachedPtss[this.setPtr],
  382. alreadyUpdateYUV: !0
  383. })) : this.updateDropFrame += 1,
  384. this.decoderWorker.postMessage({
  385. t: 2,
  386. frameCnt: this.cachedPtss[this.setPtr],
  387. buffer: this.cachedStreams[this.setPtr]
  388. }, [this.cachedStreams[this.setPtr].buffer])),
  389. this.getPtr = (this.getPtr + 1) % this.cachedLength);
  390. const t = e.data.metadata;
  391. if ((n = t == null ? void 0 : t.traceIds) != null && n.length) {
  392. for (const o of t.traceIds)
  393. if (this.traceIdMap.has(o)) {
  394. const a = this.traceIdMap.get(o);
  395. a != null && (a.readyTime = Date.now(),
  396. a.status = 2)
  397. }
  398. }
  399. if (e.data.pts == this.moveStartPts && (this.MoveProcessDelay = Date.now() - this.StartMovingTs),
  400. this.userId_test = this.rtcp.network.room.userId,
  401. this.inMovingMode) {
  402. const o = Date.now()
  403. , a = o - this.lastMoveProcessTime;
  404. this.moveProcessCircular.add(a),
  405. this.lastMoveProcessTime = o
  406. }
  407. const r = this.setPtr;
  408. this.cachedStreams[r] = e.data.data,
  409. this.cachedMetas[r] = e.data.metadata,
  410. this.cachedPtss[r] = e.data.pts,
  411. this.cachedRender[r] = !1,
  412. this.cachedResolution[r] = {
  413. width: e.data.width,
  414. height: e.data.height
  415. },
  416. this.setPtr = (this.setPtr + 1) % this.cachedLength
  417. }
  418. SendCacheFrameInfo(e) {
  419. var h, f, d, _, g, m, v;
  420. const t = e.data.cachedKey
  421. , r = e.data.metadata
  422. , n = t
  423. , o = r
  424. , a = (d = (f = (h = o.newUserStates) == null ? void 0 : h.find(y=>y.userId === this.rtcp.network.room.userId)) == null ? void 0 : f.playerState) == null ? void 0 : d.roomTypeId
  425. , s = this.rtcp.network.room.skinId
  426. , l = (v = (m = (g = (_ = o.newUserStates) == null ? void 0 : _.find(y=>y.userId === this._rtcp.network.room.userId)) == null ? void 0 : g.playerState) == null ? void 0 : m.player) == null ? void 0 : v.position
  427. , u = {
  428. MsgType: 1,
  429. FrameCacheMsg: {
  430. FrameIndex: n,
  431. RoomTypeId: a,
  432. SkinID: s,
  433. Position: l
  434. }
  435. };
  436. let c = "";
  437. try {
  438. c = JSON.stringify(u)
  439. } catch (y) {
  440. log$m.error(y);
  441. return
  442. }
  443. }
  444. ReceivePanoramaDecodeMessage(e) {
  445. log$m.info("Receive Panorama Image in Workers.ts"),
  446. MaskSetToOne(e.data.tileId, this.PanoView);
  447. let t = 0, r;
  448. const n = this.PendingMasks.length;
  449. for (t = 0; t < n; t++) {
  450. const o = this.PendingMasks[t].buffer
  451. , a = new DataView(o)
  452. , s = new ArrayBuffer(8)
  453. , l = new DataView(s);
  454. if (operateForDataView(this.PanoView, a, l, (u,c)=>c ^ u & c),
  455. IsAll0(l)) {
  456. r = this.PendingMasks[t].angle;
  457. break
  458. }
  459. }
  460. for (let o = t; o < n; o++)
  461. this.PendingMasks.pop();
  462. this.executeFunction("panorama", {
  463. data: e.data.data,
  464. tileId: e.data.tileId,
  465. pos: {
  466. x: e.data.x,
  467. y: e.data.y,
  468. z: e.data.z
  469. },
  470. uuid: e.data.uuid,
  471. finished: !0,
  472. matchAngle: r
  473. })
  474. }
  475. enable_decoder_queue_logging() {
  476. this.decoderWorker.postMessage({
  477. t: 100,
  478. status: !0
  479. })
  480. }
  481. disable_decoder_queue_logging() {
  482. this.decoderWorker.postMessage({
  483. t: 100,
  484. status: !1
  485. })
  486. }
  487. async init(e={
  488. width: 1280,
  489. height: 720
  490. }) {
  491. for (let r = 0; r < FRAME_COMPOSE_LENGTH; r++) {
  492. const n = {
  493. buffer: new Uint8Array(2621440),
  494. size: 0,
  495. startReceiveTime: 0,
  496. serverTime: 0,
  497. frameCnt: -1
  498. };
  499. this.cacheFrameComposes.push(n)
  500. }
  501. const t = new Blob([decoder],{
  502. type: "application/javascript"
  503. });
  504. return this.decoderWorker = new Worker(URL.createObjectURL(t)),
  505. this.decoderWorker.postMessage({
  506. t: 9,
  507. url: WASM_URLS[WASM_Version],
  508. jitterLength: DECODER_PASSIVE_JITTER
  509. }),
  510. this.decoderWorker.postMessage({
  511. t: 1,
  512. config: e
  513. }),
  514. new Promise(r=>{
  515. this.decoderWorker.onmessage = n=>{
  516. switch (n.data.t) {
  517. case 0:
  518. this.ReceiveDecodeMessage(n);
  519. break;
  520. case 1:
  521. this.UpdateStats(n);
  522. break;
  523. case 2:
  524. r();
  525. break;
  526. case 3:
  527. this.SendCacheFrameInfo(n);
  528. break;
  529. case 4:
  530. {
  531. const o = new Date().toISOString()
  532. , a = USER_ID + "-" + PAGE_SESSION + "-" + SERVER_SESSION + "-" + o + ".264";
  533. uploadStream(COS_PREFIX + a, n.data.fileObj);
  534. break
  535. }
  536. case 5:
  537. this.executeFunction("signal", {
  538. signal: n.data.metadata,
  539. pts: -1,
  540. alreadyUpdateYUV: !1
  541. });
  542. break;
  543. case 6:
  544. log$m.infoAndReportMeasurement(n.data),
  545. log$m.debug("WASM Ready Cost");
  546. break;
  547. case 7:
  548. this.ReceivePanoramaDecodeMessage(n);
  549. break;
  550. case 8:
  551. {
  552. const o = {
  553. MstType: 0
  554. };
  555. let a = "";
  556. try {
  557. a = JSON.stringify(o)
  558. } catch (l) {
  559. log$m.error(l);
  560. return
  561. }
  562. const s = "wasm:" + a;
  563. this._rtcp.sendStringData(s);
  564. break
  565. }
  566. case 9:
  567. {
  568. log$m.info(n.data.printMsg);
  569. break
  570. }
  571. case 10:
  572. {
  573. log$m.error(n.data.printMsg),
  574. this.executeFunction("error", {
  575. code: n.data.code,
  576. message: n.data.printMsg
  577. });
  578. break
  579. }
  580. default:
  581. log$m.error("Receive unknown message event from decoder"),
  582. log$m.debug(n.data);
  583. break
  584. }
  585. }
  586. }
  587. )
  588. }
  589. UpdateYUV() {
  590. var t, r;
  591. const e = this.getPtr;
  592. if (this.cachedMetas[e] != null && !this.cachedRender[e]) {
  593. const n = Date.now();
  594. if (this.firstUpdateYUV) {
  595. const h = ((t = this.cachedStreams[e]) == null ? void 0 : t.byteLength) || 0;
  596. log$m.infoAndReportMeasurement({
  597. metric: "firstUpdateStreamLength",
  598. value: h,
  599. group: "joinRoom"
  600. }),
  601. this.firstUpdateYUV = !1
  602. }
  603. this.cachedStreams[e] != null && this.executeFunction("stream", {
  604. stream: this.cachedStreams[e],
  605. width: this.cachedResolution[e].width,
  606. height: this.cachedResolution[e].height,
  607. pts: this.cachedPtss[e]
  608. });
  609. const o = Date.now();
  610. this.cachedStreams[e] != null && this.decoderWorker.postMessage({
  611. t: 2,
  612. frameCnt: this.cachedPtss[e],
  613. buffer: this.cachedStreams[e]
  614. }, [this.cachedStreams[e].buffer]);
  615. const a = Date.now()
  616. , s = o - n
  617. , l = a - o;
  618. (s > 33 || l > 10) && log$m.debug("[wwwarning] updateYUV takes ", s, " ms, postMessage takes ", l, " ms for index ", this.cachedPtss[e]),
  619. o - this.lastRenderTs > 84 && this.JankTimes++,
  620. o - this.lastRenderTs > 125 && this.bigJankTimes++,
  621. this.lastRenderTs = o;
  622. const u = o - n;
  623. this.updateYUVCircular.add(u);
  624. const c = this.cachedMetas[e];
  625. if ((r = c == null ? void 0 : c.traceIds) != null && r.length) {
  626. for (const h of c.traceIds)
  627. if (this.traceIdMap.has(h)) {
  628. const f = this.traceIdMap.get(h);
  629. if (f != null) {
  630. f.displayTime = Date.now(),
  631. f.status = 3;
  632. const d = f.receiveTime - f.startTime
  633. , _ = f.readyTime - f.receiveTime
  634. , g = f.displayTime - f.readyTime
  635. , m = f.displayTime - f.startTime;
  636. this.responseTimeArray.push(d),
  637. this.processTimeArray.push(_),
  638. this.displayTimeArray.push(g),
  639. this.overallTimeArray.push(m),
  640. this.traceIdMap.delete(h)
  641. }
  642. }
  643. }
  644. if (this.cachedPtss[e] == this.moveStartPts && (this.MoveDisplayDelay = Date.now() - this.StartMovingTs),
  645. this.inMovingMode) {
  646. const h = Date.now()
  647. , f = h - this.lastMoveDisplayTime;
  648. this.moveDisplayCircular.add(f),
  649. this.lastMoveDisplayTime = h
  650. }
  651. this.executeFunction("signal", {
  652. signal: this.cachedMetas[e],
  653. pts: this.cachedPtss[e],
  654. alreadyUpdateYUV: !0
  655. }),
  656. this.cachedRender[e] = !0,
  657. this.getPtr = (this.getPtr + 1) % this.cachedLength
  658. }
  659. }
  660. unmarshalPano(e) {
  661. const t = new DataView(e);
  662. if (t.getUint32(0) != 1723558763)
  663. return !1;
  664. console.log("Receive Pano Message"),
  665. t.getUint16(4);
  666. const n = t.getUint16(6)
  667. , o = t.getUint32(8)
  668. , a = t.getUint32(12) - (1 << 30) * 2
  669. , s = t.getUint32(16) - (1 << 30) * 2
  670. , l = t.getUint32(20) - (1 << 30) * 2
  671. , u = t.getUint32(24)
  672. , c = new Uint8Array(e).subarray(28, 64)
  673. , h = String.fromCharCode.apply(null, c)
  674. , f = t.getUint32(64)
  675. , d = e.byteLength - n;
  676. if (d == u) {
  677. const g = {
  678. data: new Uint8Array(e).subarray(n),
  679. mediaLen: u,
  680. tileId: o,
  681. uuid: h,
  682. x: a,
  683. y: s,
  684. z: l
  685. };
  686. this.decoderWorker.postMessage({
  687. t: 8,
  688. data: g
  689. })
  690. } else {
  691. const _ = new Uint8Array(e,n,d);
  692. if (this.cachePanoTileID == o) {
  693. if (this.panoCacheBuffer.set(_, f),
  694. this.panoCacheSize += d,
  695. this.panoCacheSize === u) {
  696. const m = {
  697. data: new Uint8Array(this.panoCacheBuffer).slice(0, u),
  698. mediaLen: u,
  699. tileId: o,
  700. uuid: h,
  701. x: a,
  702. y: s,
  703. z: l
  704. };
  705. this.decoderWorker.postMessage({
  706. t: 8,
  707. data: m
  708. }),
  709. this.panoCacheSize = 0
  710. }
  711. } else
  712. this.panoCacheBuffer.set(_, f),
  713. this.panoCacheSize = d,
  714. this.cachePanoTileID = o
  715. }
  716. return !0
  717. }
  718. clearMoveArray() {
  719. this.MovingTraceId = "",
  720. this.inMovingMode = !1,
  721. this.StartMovingTs = 0,
  722. this.MoveToFrameCnt = 0,
  723. this.MoveResponseDelay = 0,
  724. this.MoveProcessDelay = 0,
  725. this.MoveDisplayDelay = 0,
  726. this.moveStartPts = -1,
  727. this.moveResponseCircular.clear(),
  728. this.moveProcessCircular.clear(),
  729. this.moveDisplayCircular.clear(),
  730. this.moveEvent = ""
  731. }
  732. getIsMoving(e) {
  733. let t;
  734. if (typeof e.newUserStates != "undefined")
  735. for (let r = 0; r < e.newUserStates.length; r++) {
  736. const n = e.newUserStates[r];
  737. if (n.userId == this.rtcp.network.room.userId) {
  738. t = n.renderInfo.isMoving;
  739. break
  740. }
  741. }
  742. return t
  743. }
  744. isHeartBeatPacket(e, t) {
  745. return new DataView(e).getUint32(0) == 2009889916
  746. }
  747. resetSendTimeDiff() {
  748. this.prevSenderTs = 0,
  749. this.serverSendTimeArray.clear()
  750. }
  751. calcSendTimeDiff(e) {
  752. if (this.prevSenderTs == -1) {
  753. this.prevSenderTs = e;
  754. return
  755. }
  756. const t = e - this.prevSenderTs;
  757. this.serverSendTimeArray.add(t),
  758. this.prevSenderTs = e
  759. }
  760. unmarshalStream(e) {
  761. var T, C, A, S, P, R, M, x, I, w;
  762. const t = new DataView(e);
  763. if (t.getUint32(0) != 1437227610)
  764. return !1;
  765. t.getUint16(4);
  766. const n = t.getUint16(6)
  767. , o = t.getUint16(8)
  768. , a = o
  769. , s = t.getUint16(10);
  770. let l = !1;
  771. s == 1 && (l = !0);
  772. const u = t.getUint32(12)
  773. , c = t.getUint32(16)
  774. , h = t.getUint32(20)
  775. , f = t.getUint16(24)
  776. , d = t.getUint16(26)
  777. , _ = t.getUint32(28)
  778. , g = t.getUint32(n - 4)
  779. , m = u + c
  780. , v = e.byteLength - n
  781. , y = new Uint8Array(e,n,v);
  782. this.calcSendTimeDiff(h);
  783. let b;
  784. if (this.inPanoMode && (c > 0 || f))
  785. return log$m.error("Stream Protocal Violation: receive illegal stream in Pano mode"),
  786. !0;
  787. if (v === m) {
  788. this.receivedMedia++;
  789. const O = new Uint8Array(e).subarray(n);
  790. h - this.lastServerTS > 60 ? this.serverFrameSlow++ : h - this.lastServerTS < 16 && this.serverFrameFast++;
  791. const D = Date.now();
  792. D - this.lastClientTS > 60 ? this.clientFrameSlow++ : D - this.lastClientTS < 16 && this.clientFrameFast++;
  793. const F = c === 0
  794. , V = h - this.lastServerTS;
  795. this.lastServerTS != 0 && ((o + 65536 - this.lastSeq) % 65536 === 1 && this.lastIsPureMeta == F && (F ? this.srvMetaIntervalCircular.add(V) : this.srvMediaIntervalCircular.add(V)),
  796. this.frameServerCircular.add(V),
  797. this.frameClientCircular.add(D - this.lastClientTS)),
  798. this.lastSeq = o,
  799. this.lastIsPureMeta = F,
  800. this.lastServerTS = h,
  801. this.lastClientTS = D;
  802. const N = O.subarray(0, u)
  803. , L = Date.now()
  804. , k = JSON.parse(this.Stringify(N))
  805. , U = Date.now();
  806. this.showAllReceivedMetadata && console.log(h, D, k),
  807. this.metaParseAraay.push(U - L),
  808. (T = k.traceIds) != null && T.length && this.processMetaWithTraceId(k),
  809. c != 0 && this.moveStartPts == -1 && this.inMovingMode && (this.moveStartPts = o),
  810. this.moveStartPts == o && (this.MoveResponseDelay = Date.now() - this.StartMovingTs,
  811. console.log("move response delay: ", o, this.moveStartPts, this.MoveResponseDelay));
  812. const z = this.getIsMoving(k);
  813. if (this.inMovingMode && z == 0 && this.lastIsMoving == 1 && this.clearMoveArray(),
  814. typeof z != "undefined" && (this.lastIsMoving = z),
  815. this.inMovingMode) {
  816. const G = Date.now()
  817. , W = G - this.lastMoveResponseTime;
  818. this.moveResponseCircular.add(W),
  819. this.lastMoveResponseTime = G
  820. }
  821. (f || d) && (b = (P = (S = (A = (C = k.newUserStates) == null ? void 0 : C.find(G=>G.userId === this._rtcp.network.room.userId)) == null ? void 0 : A.playerState) == null ? void 0 : S.player) == null ? void 0 : P.position);
  822. const H = {
  823. t: 0,
  824. data: O,
  825. mediaLen: c,
  826. metaLen: u,
  827. metadata: k,
  828. frameCnt: a,
  829. server_ts: h,
  830. isIDR: l,
  831. cacheRequest: d,
  832. cached: f,
  833. cachedKey: _,
  834. position: b
  835. };
  836. if (this.inPanoMode)
  837. return this.executeFunction("signal", {
  838. signal: k,
  839. pts: -1,
  840. alreadyUpdateYUV: !0
  841. }),
  842. !0;
  843. if (this.decoderWorker.postMessage(H, [O.buffer]),
  844. !this.firstMediaReceived) {
  845. this.firstMediaArraval = Date.now();
  846. const G = this.firstMediaArraval - this.rtcp.network.room._startTime;
  847. log$m.infoAndReportMeasurement({
  848. metric: "firstMediaArravalAt",
  849. value: G,
  850. group: "joinRoom"
  851. }),
  852. this.firstMediaReceived = !0
  853. }
  854. } else {
  855. const O = this.hasFrmCntInCache(a);
  856. if (O != -1)
  857. if (this.cacheFrameComposes[O].buffer.set(y, g),
  858. this.cacheFrameComposes[O].size += v,
  859. this.cacheFrameComposes[O].size === m) {
  860. const D = new Uint8Array(this.cacheFrameComposes[O].buffer).slice(0, m);
  861. this.cacheFrameComposes[O].frameCnt = -1,
  862. this.cacheFrameComposes[O].size = 0,
  863. this.cacheFrameComposes[O].startReceiveTime = 0,
  864. this.cacheFrameComposes[O].serverTime = 0,
  865. this.receivedMedia++,
  866. h - this.lastServerTS > 60 ? this.serverFrameSlow++ : h - this.lastServerTS < 16 && this.serverFrameFast++;
  867. const F = Date.now();
  868. F - this.lastClientTS > 60 ? this.clientFrameSlow++ : F - this.lastClientTS < 16 && this.clientFrameFast++,
  869. this.lastServerTS != 0 && (this.frameServerCircular.add(h - this.lastServerTS),
  870. this.frameClientCircular.add(F - this.lastClientTS)),
  871. this.lastServerTS = h,
  872. this.lastClientTS = F;
  873. const V = D.subarray(0, u)
  874. , N = Date.now()
  875. , L = JSON.parse(this.Stringify(V))
  876. , k = Date.now();
  877. this.showAllReceivedMetadata && console.log(h, F, L),
  878. this.metaParseAraay.push(k - N),
  879. (R = L.traceIds) != null && R.length && this.processMetaWithTraceId(L),
  880. c != 0 && this.moveStartPts == -1 && this.inMovingMode && (this.moveStartPts = o),
  881. this.moveStartPts == o && (this.MoveResponseDelay = Date.now() - this.StartMovingTs);
  882. const U = this.getIsMoving(L);
  883. if (this.inMovingMode && U == 0 && this.lastIsMoving == 1 && this.clearMoveArray(),
  884. typeof U != "undefined" && (this.lastIsMoving = U),
  885. this.inMovingMode) {
  886. const H = Date.now()
  887. , G = H - this.lastMoveResponseTime;
  888. this.moveResponseCircular.add(G),
  889. this.lastMoveResponseTime = H
  890. }
  891. (f || d) && (b = (w = (I = (x = (M = L.newUserStates) == null ? void 0 : M.find(H=>H.userId === this._rtcp.network.room.userId)) == null ? void 0 : x.playerState) == null ? void 0 : I.player) == null ? void 0 : w.position);
  892. const z = {
  893. t: 0,
  894. data: D,
  895. mediaLen: c,
  896. metaLen: u,
  897. metadata: L,
  898. frameCnt: a,
  899. server_ts: h,
  900. isIDR: l,
  901. cacheRequest: d,
  902. cached: f,
  903. cachedKey: _,
  904. position: b
  905. };
  906. if (this.inPanoMode)
  907. return this.executeFunction("signal", {
  908. signal: L,
  909. pts: -1,
  910. alreadyUpdateYUV: !0
  911. }),
  912. !0;
  913. if (this.decoderWorker.postMessage(z, [D.buffer]),
  914. !this.firstMediaReceived) {
  915. this.firstMediaArraval = Date.now();
  916. const H = this.firstMediaArraval - this.rtcp.network.room._startTime;
  917. log$m.infoAndReportMeasurement({
  918. metric: "firstMediaArravalAt",
  919. value: H,
  920. group: "joinRoom"
  921. }),
  922. this.firstMediaReceived = !0
  923. }
  924. } else
  925. this.cacheFrameComposes[O].size > m && log$m.debug("I frame exceed, cache size is ", this.cacheSize, ", total size is ", m);
  926. else if (O == -1) {
  927. let D = this.hasFrmCntInCache(-1);
  928. if (D == -1) {
  929. let F = Date.now() + 1e18
  930. , V = -1;
  931. for (let N = 0; N < this.cacheFrameComposes.length; N++)
  932. this.cacheFrameComposes[N].serverTime < F && (F = this.cacheFrameComposes[N].serverTime,
  933. V = N);
  934. D = V
  935. }
  936. this.cacheFrameComposes[D].buffer.set(y, g),
  937. this.cacheFrameComposes[D].size = v,
  938. this.cacheFrameComposes[D].frameCnt = a,
  939. this.cacheFrameComposes[D].startReceiveTime = Date.now(),
  940. this.cacheFrameComposes[D].serverTime = h
  941. }
  942. }
  943. return !0
  944. }
  945. reset() {
  946. log$m.debug("Worker reset is called"),
  947. this.cacheFrameCnt = 0,
  948. this.receivedMedia = 0,
  949. this.reconnectSignal = !0,
  950. this.decoderWorker.postMessage({
  951. t: 4
  952. })
  953. }
  954. dataHandleOff(e) {
  955. log$m.debug("hhh")
  956. }
  957. dataHandle(e) {
  958. this.saveframe && (this.decoderWorker.postMessage({
  959. t: 6
  960. }),
  961. this.saveframe = !1),
  962. this.SaveMediaStream && (this.decoderWorker.postMessage({
  963. t: 7
  964. }),
  965. this.SaveMediaStream = !1);
  966. const t = new Uint8Array(e);
  967. if (t.length >= 4 && this.isHeartBeatPacket(t.buffer, t.length) == !0)
  968. return;
  969. if (t.length > 36 && this.unmarshalStream(t.buffer) == !0) {
  970. this.reconnectSignal && (this.executeFunction("reconnectedFrame", {}),
  971. this.reconnectSignal = !1);
  972. return
  973. }
  974. if (t.length > 20 && this.unmarshalPano(t.buffer) == !0)
  975. return;
  976. this.noWasmBytesReceived += e.byteLength;
  977. const r = JSON.parse(this.Stringify(t));
  978. this.executeFunction("signal", {
  979. signal: r,
  980. pts: -1,
  981. alreadyUpdateYUV: !0
  982. })
  983. }
  984. changePanoMode(e) {
  985. this.inPanoMode = e
  986. }
  987. uploadDataToServer() {
  988. this.DynamicPanoTest == !0 && (this.onRotateInPanoMode({
  989. traceId: "b2e1a296-6438-4371-8a31-687beb724ebe"
  990. }),
  991. this.DynamicPanoTest = !1);
  992. function e(ie, ee) {
  993. return ee == -1 && (ee = 0),
  994. ie + ee
  995. }
  996. function t(ie, ee) {
  997. return Math.max(ie, ee)
  998. }
  999. const r = this.responseTimeArray.reduce(e, 0) / this.responseTimeArray.length || 0
  1000. , n = this.processTimeArray.reduce(e, 0) / this.processTimeArray.length || 0
  1001. , o = this.displayTimeArray.reduce(e, 0) / this.displayTimeArray.length || 0
  1002. , a = this.overallTimeArray.reduce(e, 0) / this.overallTimeArray.length || 0
  1003. , s = this.overallTimeArray.length;
  1004. this.responseTimeArray = [],
  1005. this.processTimeArray = [],
  1006. this.displayTimeArray = [],
  1007. this.overallTimeArray = [];
  1008. const l = this.moveResponseCircular.getThreshPercent()
  1009. , u = l[0]
  1010. , c = l[1]
  1011. , h = l[2]
  1012. , f = l[3]
  1013. , d = l[4]
  1014. , _ = d - f
  1015. , g = 1 - c / d || 0
  1016. , m = [u, c - u, h - c, f - h, _]
  1017. , v = this.moveProcessCircular.getThreshPercent()
  1018. , y = v[0]
  1019. , b = v[1]
  1020. , T = v[2]
  1021. , C = v[3]
  1022. , A = v[4]
  1023. , S = A - C
  1024. , P = 1 - b / A || 0
  1025. , R = [y, b - y, T - b, C - T, S]
  1026. , M = this.moveDisplayCircular.getThreshPercent()
  1027. , x = M[0]
  1028. , I = M[1]
  1029. , w = M[2]
  1030. , O = M[3]
  1031. , D = M[4]
  1032. , F = D - O
  1033. , V = 1 - I / D || 0
  1034. , N = [x, I - x, w - I, O - w, F]
  1035. , L = x
  1036. , k = I - x
  1037. , U = w - I
  1038. , z = O - w
  1039. , H = F
  1040. , G = this.moveResponseCircular.getAvg()
  1041. , W = this.moveProcessCircular.getAvg()
  1042. , j = this.moveDisplayCircular.getAvg()
  1043. , B = this.moveResponseCircular.getMax()
  1044. , X = this.moveProcessCircular.getMax()
  1045. , $ = this.moveDisplayCircular.getMax()
  1046. , Y = this.moveResponseCircular.getStandardDeviation()
  1047. , K = this.moveProcessCircular.getStandardDeviation()
  1048. , Z = this.moveDisplayCircular.getStandardDeviation();
  1049. this.moveResponseCircular.getIncomingAvg(),
  1050. this.moveProcessCircular.getIncomingAvg(),
  1051. this.moveDisplayCircular.getIncomingAvg(),
  1052. this.moveResponseCircular.getIncomingMax(),
  1053. this.moveProcessCircular.getIncomingMax(),
  1054. this.moveDisplayCircular.getIncomingMax(),
  1055. this.moveResponseCircular.clearIncoming(),
  1056. this.moveProcessCircular.clearIncoming(),
  1057. this.moveDisplayCircular.clearIncoming();
  1058. const q = this.frameServerCircular.getAvg()
  1059. , J = this.frameServerCircular.getMax();
  1060. this.frameClientCircular.getAvg(),
  1061. this.frameClientCircular.getMax();
  1062. const Q = this.metaParseAraay.reduce(e, 0) / this.metaParseAraay.length || 0
  1063. , te = this.metaParseAraay.reduce(t, 0);
  1064. this.metaParseAraay = [];
  1065. const re = {
  1066. mediaBytesReceived: this.mediaBytesReceived,
  1067. metaBytesReceived: this.metaBytesReceived,
  1068. packetsLost: this.packetsLost,
  1069. timestamp: Date.now(),
  1070. frameHeight: 1280,
  1071. frameWidth: 720,
  1072. framesReceived: this.receivedMedia,
  1073. framesReceivedWorker: this.receivedMedia_worker,
  1074. framesDecoded: this.receivedYUV,
  1075. framesEmited: this.receivedEmit,
  1076. decodeTimePerFrame: this.decodeTimePerFrame,
  1077. decodeTimeMaxFrame: this.decodeTimeMaxFrame,
  1078. packetsDrop: this.packetsDrop,
  1079. framesAwait: this.framesAwait,
  1080. firstMediaArraval: this.firstMediaArraval,
  1081. firstYUVDecoded: this.firstYUVDecoded,
  1082. firstRender: this.firstRender,
  1083. returnFrames: this.returnFrames,
  1084. sendOutBuffer: this.sendOutBuffer,
  1085. maxGraphicTime: this.updateYUVCircular.getMax(),
  1086. averageGraphicTime: this.updateYUVCircular.getAvg(),
  1087. jankTimes: this.JankTimes,
  1088. bigJankTimes: this.bigJankTimes,
  1089. decodeJankTimes: this.DecodeJankTimes,
  1090. bigDecodeJankTimes: this.bigDecodeJankTimes,
  1091. serverFrameSlow: this.serverFrameSlow,
  1092. serverFrameFast: this.serverFrameFast,
  1093. clientFrameSlow: this.clientFrameSlow,
  1094. clientFrameFast: this.clientFrameFast,
  1095. rtcMessageReceived: this.rtcMessageReceived,
  1096. rtcBytesReceived: this.rtcBytesReceived - this.noWasmBytesReceived,
  1097. receiveIframes: this.receiveIframes,
  1098. decodeIframes: this.decodeIframes,
  1099. avgResponseTime: r,
  1100. avgProcessTime: n,
  1101. avgDisplayTime: o,
  1102. avgOverallTime: a,
  1103. overallTimeCount: s,
  1104. responseMiss: this.responseMiss,
  1105. processMiss: this.processMiss,
  1106. displayMiss: this.displayMiss,
  1107. updateDropFrame: this.updateDropFrame,
  1108. moveEvent: this.moveEvent,
  1109. avgResponseMoveDiff: this.moveEvent == "MoveTo" ? G : 0,
  1110. avgProcessMoveDiff: this.moveEvent == "MoveTo" ? W : 0,
  1111. avgDisplayMoveDiff: this.moveEvent == "MoveTo" ? j : 0,
  1112. maxResponseMoveDiff: this.moveEvent == "MoveTo" ? B : 0,
  1113. maxProcessMoveDiff: this.moveEvent == "MoveTo" ? X : 0,
  1114. maxDisplayMoveDiff: this.moveEvent == "MoveTo" ? $ : 0,
  1115. moveResponseJank: this.moveEvent == "MoveTo" ? g : 0,
  1116. moveProcessJank: this.moveEvent == "MoveTo" ? P : 0,
  1117. moveDisplayJank: this.moveEvent == "MoveTo" ? V : 0,
  1118. moveResponseCounts: this.moveEvent == "MoveTo" ? m.toString() : "0,0,0,0,0",
  1119. moveProcessCounts: this.moveEvent == "MoveTo" ? R.toString() : "0,0,0,0,0",
  1120. moveDisplayCounts: this.moveEvent == "MoveTo" ? N.toString() : "0,0,0,0,0",
  1121. MoveDisplayCountGood: this.moveEvent == "MoveTo" ? L.toString() : "0",
  1122. MoveDisplayCountWell: this.moveEvent == "MoveTo" ? k.toString() : "0",
  1123. MoveDisplayCountFair: this.moveEvent == "MoveTo" ? U.toString() : "0",
  1124. MoveDisplayCountBad: this.moveEvent == "MoveTo" ? z.toString() : "0",
  1125. MoveDisplayCountRest: this.moveEvent == "MoveTo" ? H.toString() : "0",
  1126. moveResponseDelay: this.moveEvent == "MoveTo" ? this.MoveResponseDelay : 0,
  1127. moveProcessDelay: this.moveEvent == "MoveTo" ? this.MoveProcessDelay : 0,
  1128. moveDisplayDelay: this.moveEvent == "MoveTo" ? this.MoveDisplayDelay : 0,
  1129. sdMoveResponseLongTime: Y,
  1130. sdMoveProcessLongTime: K,
  1131. sdMoveDisplayLongTime: Z,
  1132. avgResponseFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? G : 0,
  1133. avgProcessFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? W : 0,
  1134. avgDisplayFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? j : 0,
  1135. maxResponseFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? B : 0,
  1136. maxProcessFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? X : 0,
  1137. maxDisplayFlyDiff: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? $ : 0,
  1138. flyResponseJank: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? g : 0,
  1139. flyProcessJank: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? P : 0,
  1140. flyDisplayJank: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? V : 0,
  1141. flyResponseCounts: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? m.toString() : "0,0,0,0,0",
  1142. flyProcessCounts: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? R.toString() : "0,0,0,0,0",
  1143. flyDisplayCounts: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? N.toString() : "0,0,0,0,0",
  1144. flyResponseDelay: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? this.MoveResponseDelay : 0,
  1145. flyProcessDelay: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? this.MoveProcessDelay : 0,
  1146. flyDisplayDelay: this.moveEvent == "GetOnVehicle" || this.moveEvent == "GetOnAirship" ? this.MoveDisplayDelay : 0,
  1147. avgMetaParseTime: Q,
  1148. maxMetaParseTime: te,
  1149. avgServerDiff: q,
  1150. maxServerDiff: J,
  1151. streamType: WASM_Version
  1152. };
  1153. return this.lastReturnFrames = this.returnFrames,
  1154. this.lastReceivedEmit = this.receivedEmit,
  1155. re
  1156. }
  1157. }