/* Metro module 12402; source: lib/VoiceQuality.tsx; dependencies: [57, 6, 7, 15, 17, 18, 7131, 4303, 22, 12403, 7137, 4406, 4479, 2] */ import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Module00022 from '../by-id/module-00022.js'; /* Metro dependency 22 */ import Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */ import TypedEventEmitter from '../external/discord_common/js/shared/utils/TypedEventEmitter.tsx'; /* Metro dependency 4479 */ import SystemResources from './SystemResources.tsx'; /* Metro dependency 7137 */ import NetworkQuality from './NetworkQuality.tsx'; /* Metro dependency 12403 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as HistogramModule from './Histogram.tsx'; /* Metro dependency 7131 */ function _fun94518(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94518, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:6, offset: 0x0211af88, size: 272 bytes, params: 8, frame: 19 const env0_0 = require; const handleCounter = function(a0, a1) { var r0; r0 = a1 ?? ({'accumulated': 0, 'lastValue': 0}); var accumulated = r0.accumulated; var lastValue = r0.lastValue; return {accumulated: lastValue > a0 ? accumulated + a0 : accumulated + (a0 - lastValue), lastValue: a0}; }; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = TypedEventEmitter; value = _fun94524(value); (FileImportTrackerModule).fileFinishedImporting('lib/VoiceQuality.tsx'); exports.default = value; exports.VoiceQualityEvent = {InputDeviceSampleRateChanged: 'input-device-sample-rate-changed'}; function _isNativeReflectConstruct_94519() { // fn#94519, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:172, offset: 0x0211b098, size: 98 bytes, params: 1, frame: 18 var Boolean; var prototype; var valueOf; var call; var Reflect; var construct; var closure; var value; var error; try { Boolean = global.Boolean; prototype = Boolean.prototype; valueOf = prototype.valueOf; call = valueOf.call; Reflect = global.Reflect; construct = Reflect.construct; Boolean = global.Boolean; closure = function() { }; value = Reflect.apply(construct, Reflect, [Boolean, [], closure]); value = Reflect.apply(call, valueOf, [value]); var result = !value; } catch (error) { } return (_isNativeReflectConstruct_94519_isNativeReflectConstruct = function() { return !!result; })(); } function explodePlayoutMetrics(a0) { // fn#94522, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:365, offset: 0x0211b0fa, size: 425 bytes, params: 2, frame: 35 var r17; var mean; var p75; var p95; var p99; var max; var propertyName; var propertyName2; var property; var Histogram; var value2; var value3; var value4; var value5; var value6; var value7; var report; var value9; var Math; var round; var value10; var percentiles; var value11; var value12; var value13; const object = {}; for (propertyName in a0) { property = a0[propertyName]; Histogram = (require(7131) /* metro dependency 7131: Histogram */).Histogram; if (property instanceof Histogram) { report = property.getReport([75, 95, 99]); value9 = propertyName + '_mean'; Math = global.Math; round = Math.round; mean = report.mean; object[value9] = Reflect.apply(round, Math, [mean]); value10 = propertyName + '_p75'; Math = global.Math; round = Math.round; percentiles = report.percentiles; object[value10] = Reflect.apply(round, Math, [percentiles[75]]); value11 = propertyName + '_p95'; Math = global.Math; round = Math.round; percentiles = report.percentiles; object[value11] = Reflect.apply(round, Math, [percentiles[95]]); value12 = propertyName + '_p99'; Math = global.Math; round = Math.round; percentiles = report.percentiles; object[value12] = Reflect.apply(round, Math, [percentiles[99]]); value13 = propertyName + '_max'; Math = global.Math; round = Math.round; max = report.max; object[value13] = Reflect.apply(round, Math, [max]); r17 = propertyName2; } else { value2 = propertyName + '_mean'; value3 = 0; if (property == null) { mean = value3; continue; } mean = property.mean; object[value2] = mean; value4 = propertyName + '_p75'; if (property == null) { p75 = value3; continue; } p75 = property.p75; object[value4] = p75; value5 = propertyName + '_p95'; if (property == null) { p95 = value3; continue; } p95 = property.p95; object[value5] = p95; value6 = propertyName + '_p99'; if (property == null) { p99 = value3; continue; } p99 = property.p99; object[value6] = p99; value7 = propertyName + '_max'; if (property == null) { max = value3; continue; } max = property.max; object[value7] = max; r17 = propertyName2; } } return object; } function _fun94524(a0) { // fn#94524, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:944, offset: 0x0211b2e9, size: 494 bytes, params: 2, frame: 16 const VoiceQuality2 = VoiceQuality; Inherits(VoiceQuality2, a0); return CreateClass(VoiceQuality2, [{key: 'start', value: function() { var connection = this.connection; var Stats = require(dependencyMap[11]).BaseConnectionEvent.Stats; connection.on(Stats, this.sampleStats); }}, {key: 'stop', value: function() { var connection = this.connection; var Stats = require(dependencyMap[11]).BaseConnectionEvent.Stats; connection.off(Stats, this.sampleStats); }}, {key: 'getMosStats', value: value_94536}, {key: 'getPacketStats', value: value_94538}, {key: 'getBytesStats', value: value_94540}, {key: 'getNetworkStats', value: function() { return this.networkQuality.getStats(); }}, {key: 'getSystemResourceStats', value: function() { return this.systemResources.getStats(); }}, {key: 'getBufferStats', value: value_94544}, {key: 'getFrameOpStats', value: value_94546}, {key: 'getDurationStats', value: function() { return {duration_listening: this.duration.listening, duration_speaking: this.duration.speaking, duration_participation: this.duration.participation, duration_connected: this.duration.connected}; }}, {key: 'getTransportStats', value: function() { return {decryption_failures: this.decryptionFailures, routing_failures: this.routingFailures}; }}, {key: 'getE2EEStats', value: value_94550}, {key: 'getAudioDeviceStats', value: value_94552}, {key: 'getAudioLevelStats', value: value_94553}, {key: 'getPeriodicStats', value: value_94554}, {key: 'calculateMos', value: function(a0, a1) { var r1; var r0; var value4; var value5; var value6; var value = this.calculateR(a0, a1); var value2 = 1; if (value < 0) { r0 = value2; } else { if (value > 100) { r1 = 4.5; } else { value4 = 0.035 * value; value5 = 0.0000071 * value; value6 = value - 60; value = 100 - value; value = value2 + value4 + value5 * value6 * value; r1 = value; } r0 = r1; } return r0; }}, {key: 'calculateR', value: function(a0, a1) { var r1; var value = 0.024 * a0; r1 = a0 > 177.3 ? 0.11 * (a0 - 177.3) : 0; var value4 = 122 * a1; var value5 = a1 + 10; value = 93.4 - (value + r1); return value - (10 + value4 / value5); }}]); function VoiceQuality(a0) { // fn#94525, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:956, offset: 0x0211b4d7, size: 365 bytes, params: 2, frame: 21 var environment; const value = environment.__proto__; env1_4(this, VoiceQuality); const value3 = env1_7(VoiceQuality); const value6 = env1_6(this, _isNativeReflectConstruct_94519() ? global.Reflect.construct(value3, [], env1_7(this).constructor) : value3.apply(this, undefined)); value6.connection = a0; value6.sampleAudioDevice = sampleAudioDevice; value6.appendTargetRates = appendTargetRates; value6.sampleStats = sampleStats; const defaultImport = NetworkQuality; const value7 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}}); const defaultImport3 = new defaultImport(); value6.networkQuality = defaultImport3 instanceof Object ? defaultImport3 : value7; const defaultImport2 = SystemResources; const value10 = Object.create(defaultImport2.prototype, {constructor: {value: defaultImport2}}); const defaultImport22 = new defaultImport2(); value6.systemResources = defaultImport22 instanceof Object ? defaultImport22 : value10; value6.inboundStats = {}; const Histogram = (HistogramModule).Histogram; value6.outboundStats = {'packetsSent': 0, 'bytesSent': 0, 'packetsLost': 0, 'passthroughCount': 0, 'encryptSuccessCount': 0, 'encryptFailureCount': 0, 'encryptDuration': 0, 'encryptAttempts': 0, 'encryptMaxAttempts': 0, 'encryptMissingKeyCount': 0, 'bytesAvailable': 0, 'bytesTarget': 0, 'previousTimestampMs': 0, 'aggregationDurationMs': 0, speakingAudioLevel: new Histogram()}; value6.duration = {'listening': 0, 'speaking': 0, 'participation': 0, 'connected': 0}; value6.periodicInboundStats = {}; value6.inputDeviceStats = {}; value6.outputDeviceStats = {}; return value6; function sampleAudioDevice(a0, a1) { // fn#94526, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:1203, owner: VoiceQuality.sampleAudioDevice, offset: 0x0211b644, size: 291 bytes, params: 3, frame: 18 var r3; var value; var timeToFirstCallbackMs; var sessionSampleRate; var binding; var emit; var value5; if (a0 !== undefined) { if (a0.restartCount !== undefined) { value = environment.__proto__.__proto__; a1.restartCount = handleCounter(a0.restartCount, a1.restartCount); } if (a0.bufferViolations !== undefined) { value = environment.__proto__.__proto__; a1.bufferViolations = handleCounter(a0.bufferViolations, a1.bufferViolations); } timeToFirstCallbackMs = a0.timeToFirstCallbackMs; value = 0; r3 = timeToFirstCallbackMs ?? value; r3 = value !== r3 && a1.timeToFirstCallbackMs === undefined; if (r3) { a1.timeToFirstCallbackMs = a0.timeToFirstCallbackMs; } sessionSampleRate = a0.sessionSampleRate; r3 = sessionSampleRate ?? value; if (value !== r3) { sessionSampleRate = a1.sessionSampleRate; if (sessionSampleRate !== a0.sessionSampleRate) { binding = env0_0; emit = binding.emit; value5 = environment.__proto__.__proto__; Reflect.apply(emit, binding, [env2_9.InputDeviceSampleRateChanged, a0.sessionSampleRate ?? value]); } sessionSampleRate = a0.sessionSampleRate; a1.sessionSampleRate = sessionSampleRate; } value = a0.timeFromConnectToFirstCallbackMs !== undefined; r3 = value && a1.timeFromConnectToFirstCallbackMs === undefined; if (r3) { a1.timeFromConnectToFirstCallbackMs = a0.timeFromConnectToFirstCallbackMs; } } } function VoiceQualitySampleStats(a0) { // fn#94528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:2227, owner: VoiceQuality.sampleStats, offset: 0x0211b81d, size: 591 bytes, params: 2, frame: 26 var environment; var r1; var r2; var binding; var networkQuality; var incrementNetworkStats; var value2; var moduleValue; var duration; var connected; var outboundStats; var packetsSent; var defaultImport; var reduce; var inboundStats; var value3; var defaultImport2; var forEach; var rtp; var transport; var appendTargetRates; var defaultImport3; var audioDevice; var sampleAudioDevice; var packetsSent2; var value4; var speaking; var defaultImport4; var listening; var participation; const env0_0 = a0; if (a0 != null) { binding = env0_0; networkQuality = binding.networkQuality; incrementNetworkStats = networkQuality.incrementNetworkStats; value2 = environment.__proto__.__proto__; moduleValue = require(4303) /* metro dependency 4303: TimeUtils */; Reflect.apply(incrementNetworkStats, networkQuality, [moduleValue.now()]); binding.systemResources.takeSample(); duration = binding.duration; connected = duration.connected; duration.connected = typeof connected === 'bigint' ? connected + 1n : +connected + 1; outboundStats = binding.outboundStats; packetsSent = outboundStats.packetsSent; defaultImport = importDefault(22) /* metro dependency 22 */; reduce = defaultImport.reduce; inboundStats = binding.inboundStats; value3 = Reflect.apply(reduce, defaultImport, [inboundStats, function(a0, a1) { a0.packetsReceived = a0.packetsReceived + a1.packetsReceived; return a0; }, {packetsReceived: 0}]); var env0_1 = 0; defaultImport2 = importDefault(22) /* metro dependency 22 */; forEach = defaultImport2.forEach; rtp = a0.rtp; Reflect.apply(forEach, defaultImport2, [rtp.outbound, _fun94530]); transport = a0.transport; binding.decryptionFailures = transport.decryptionFailures; transport = a0.transport; binding.routingFailures = transport.routingFailures; appendTargetRates = binding.appendTargetRates; outboundStats = binding.outboundStats; transport = a0.transport; Reflect.apply(appendTargetRates, binding, [outboundStats, transport.availableOutgoingBitrate, env0_1]); defaultImport3 = importDefault(22) /* metro dependency 22 */; forEach = defaultImport3.forEach; rtp = a0.rtp; Reflect.apply(forEach, defaultImport3, [rtp.inbound, _fun94531]); audioDevice = a0.audioDevice; if (audioDevice !== undefined) { binding = env0_0; sampleAudioDevice = binding.sampleAudioDevice; audioDevice = a0.audioDevice; Reflect.apply(sampleAudioDevice, binding, [audioDevice.input, binding.inputDeviceStats]); sampleAudioDevice = binding.sampleAudioDevice; audioDevice = a0.audioDevice; Reflect.apply(sampleAudioDevice, binding, [audioDevice.output, binding.outputDeviceStats]); } outboundStats = env0_0.outboundStats; packetsSent2 = outboundStats.packetsSent; value4 = false; if (packetsSent2 > packetsSent) { duration = env0_0.duration; speaking = duration.speaking; duration.speaking = typeof speaking === 'bigint' ? speaking + 1n : +speaking + 1; r1 = true; } else { r1 = value4; } defaultImport4 = importDefault(22) /* metro dependency 22 */; reduce = defaultImport4.reduce; inboundStats = env0_0.inboundStats; if (Reflect.apply(reduce, defaultImport4, [inboundStats, _fun94533, {packetsReceived: 0}]).packetsReceived > value3.packetsReceived) { duration = env0_0.duration; listening = duration.listening; duration.listening = typeof listening === 'bigint' ? listening + 1n : +listening + 1; r2 = true; } else { r2 = value4; } r1 = !r1 ? r2 : r1; if (r1) { duration = env0_0.duration; participation = duration.participation; duration.participation = typeof participation === 'bigint' ? participation + 1n : +participation + 1; } } function _fun94530(a0) { // fn#94530, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:2528, offset: 0x0211ba8a, size: 424 bytes, params: 2, frame: 18 var r2; var r7; var bitrateTarget; var value; var value3; var binding; var object; var speakingAudioLevel; var addSample; var Math; if (a0.type === 'audio') { bitrateTarget = a0.bitrateTarget; value = 0; r2 = bitrateTarget ?? value; value3 = environment.__proto__; binding = env1_0; object = {}; copyDataProperties(object, binding.outboundStats, undefined); object['packetsSent'] = a0.packetsSent; object['bytesSent'] = a0.bytesSent; r7 = a0.packetsLost ?? value; object['packetsLost'] = r7; r7 = a0.passthroughCount ?? value; object['passthroughCount'] = r7; r7 = a0.encryptSuccessCount ?? value; object['encryptSuccessCount'] = r7; r7 = a0.encryptFailureCount ?? value; object['encryptFailureCount'] = r7; r7 = a0.encryptDuration ?? value; object['encryptDuration'] = r7; r7 = a0.encryptAttempts ?? value; object['encryptAttempts'] = r7; r7 = a0.encryptMaxAttempts ?? value; object['encryptMaxAttempts'] = r7; object['encryptMissingKeyCount'] = a0.encryptMissingKeyCount ?? value; binding.outboundStats = object; value = global.Boolean(a0.audioDetected); value = value === true; r2 = value && a0.audioLevel != null; if (r2) { speakingAudioLevel = env1_0.outboundStats.speakingAudioLevel; addSample = speakingAudioLevel.addSample; Math = global.Math; Reflect.apply(addSample, speakingAudioLevel, [20 * Math.log(a0.audioLevel)]); } } } function _fun94531(a0, a1) { // fn#94531, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:3438, offset: 0x0211bc32, size: 57 bytes, params: 3, frame: 14 var environment; const env0_0 = a1; const value = environment.__proto__.__proto__.__proto__; (Module00022).forEach(a0, _fun94532); function _fun94532(a0) { // fn#94532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:3467, offset: 0x0211bc6b, size: 1721 bytes, params: 2, frame: 37 var r23; var r16; var r15; var r1; var audioJitterBufferHistogram; var r0; var audioJitterTargetHistogram; var audioJitterDelayHistogram; var r12; var r10; var r13; var r6; var value; var inboundStats; var property; var value3; var ping; var value4; var packetsReceived; var packetsLost; var bytesReceived; var nackCount; var object; var value5; var value6; const Histogram = (HistogramModule).Histogram; var histogram; var value9; var value12; var addSamples; var object2; var object3; var object4; var periodicInboundStats; var performance; var value15; var value16; var mosBuckets; var binding; var calculateMos; var value19; var value20; var defaultImport; var value21; var value22; var property2; var object5; var mosCount; var accelerateRateSum; var expandRateSum; var preemptiveExpandRateSum; if (a0.type === 'audio') { value = environment.__proto__.__proto__; inboundStats = env2_0.inboundStats; property = inboundStats[require]; value3 = environment.__proto__; ping = env1_0.transport.ping; value4 = 0; r23 = ping ?? value4; packetsReceived = a0.packetsReceived; packetsLost = a0.packetsLost; bytesReceived = a0.bytesReceived; nackCount = a0.nackCount; r16 = a0.fecPacketsReceived ?? value4; r15 = a0.fecPacketsDiscarded ?? value4; r1 = a0.jitterBuffer ?? value4; object = {}; object.audioJitterBuffer = a0.audioJitterBuffer; value5 = undefined; audioJitterBufferHistogram = property == null ? value5 : property.bufferStats.audioJitterBufferHistogram; if (audioJitterBufferHistogram != null) { r0 = audioJitterBufferHistogram; } else { value6 = environment.__proto__.__proto__.__proto__.__proto__; histogram = new Histogram(); } object.audioJitterBufferHistogram = r0; object.audioJitterTarget = a0.audioJitterTarget; audioJitterTargetHistogram = property == null ? value5 : property.bufferStats.audioJitterTargetHistogram; if (audioJitterTargetHistogram != null) { r0 = audioJitterTargetHistogram; } else { value9 = environment.__proto__.__proto__.__proto__.__proto__; histogram = new Histogram(); } object.audioJitterTargetHistogram = r0; object.audioJitterDelay = a0.audioJitterDelay; audioJitterDelayHistogram = property == null ? value5 : property.bufferStats.audioJitterDelayHistogram; if (audioJitterDelayHistogram != null) { r0 = audioJitterDelayHistogram; } else { value12 = environment.__proto__.__proto__.__proto__.__proto__; histogram = new Histogram(); } object.audioJitterDelayHistogram = r0; object.relativeReceptionDelay = a0.relativeReceptionDelay; object.relativePlayoutDelay = a0.relativePlayoutDelay; audioJitterBufferHistogram = object.audioJitterBufferHistogram; addSamples = audioJitterBufferHistogram.addSamples; r0 = a0.audioJitterBufferSamples ?? []; Reflect.apply(addSamples, audioJitterBufferHistogram, [r0]); audioJitterDelayHistogram = object.audioJitterDelayHistogram; addSamples = audioJitterDelayHistogram.addSamples; r0 = a0.audioJitterDelaySamples ?? []; Reflect.apply(addSamples, audioJitterDelayHistogram, [r0]); audioJitterTargetHistogram = object.audioJitterTargetHistogram; addSamples = audioJitterTargetHistogram.addSamples; r0 = a0.audioJitterTargetSamples ?? []; Reflect.apply(addSamples, audioJitterTargetHistogram, [r0]); object2 = {}; object2.silent = a0.opSilence; object2.normal = a0.opNormal; object2.merged = a0.opMerge; object2.expanded = a0.opExpand; object2.accelerated = a0.opAccelerate; object2.preemptiveExpanded = a0.opPreemptiveExpand; object2.cng = a0.opCNG; object3 = {}; r0 = a0.passthroughCount ?? value4; object3.passthroughCount = r0; r0 = a0.decryptSuccessCount ?? value4; object3.decryptSuccessCount = r0; r0 = a0.decryptFailureCount ?? value4; object3.decryptFailureCount = r0; r0 = a0.decryptDuration ?? value4; object3.decryptDuration = r0; r0 = a0.decryptAttempts ?? value4; object3.decryptAttempts = r0; r0 = a0.decryptMissingKeyCount ?? value4; object3.decryptMissingKeyCount = r0; r0 = a0.decryptInvalidNonceCount ?? value4; object3.decryptInvalidNonceCount = r0; if (property != null) { value15 = packetsReceived - property.packetsReceived; value16 = packetsLost - property.packetsLost; mosBuckets = property.mosBuckets; r10 = property.decryptFailureBeforeSuccessCount ?? (object3.decryptSuccessCount > value4 ? object3.decryptFailureCount : value5); if (value15 > value4 && value16 >= value4) { binding = env2_0; calculateMos = binding.calculateMos; value19 = r23 + r1; value20 = environment.__proto__.__proto__.__proto__.__proto__; defaultImport = importDefault(22) /* metro dependency 22 */; value21 = Reflect.apply(calculateMos, binding, [value19, defaultImport.clamp(value16 / (value15 + value16), value4, 1)]); value22 = global.Math.floor(value21); property2 = mosBuckets[value22]; mosBuckets[value22] = typeof property2 === 'bigint' ? property2 + 1n : +property2 + 1; r13 = value21; } else { r13 = value4; } inboundStats = env2_0.inboundStats; object5 = {packetsReceived: packetsReceived, bytesReceived: bytesReceived, packetsLost: packetsLost}; object5.nackCount = nackCount ?? value4; object5.fecPacketsReceived = r16; object5.fecPacketsDiscarded = r15; object5.mos = r13; object5.mosSum = property.mosSum + r13; mosCount = property.mosCount; r13 = r13 > value4 ? 1 : value4; object5.mosCount = mosCount + r13; object5.mosBuckets = mosBuckets; object5.bufferStats = object; object5.frameOpStats = object2; object5.decryptFailureBeforeSuccessCount = r10; copyDataProperties(object5, object3, undefined); inboundStats[require] = object5; binding = env2_0; periodicInboundStats = binding.periodicInboundStats; object = {}; object.previousTimestampMs = binding.periodicInboundStats[require].previousTimestampMs; object.previous = binding.periodicInboundStats[require].previous; object.currentTimestampMs = global.performance.now(); object.current = object2; accelerateRateSum = binding.periodicInboundStats[require].accelerateRateSum; r6 = a0.accelerateRate ?? value4; object.accelerateRateSum = accelerateRateSum + r6; expandRateSum = env2_0.periodicInboundStats[require].expandRateSum; r6 = a0.expandRate ?? value4; object.expandRateSum = expandRateSum + r6; preemptiveExpandRateSum = env2_0.periodicInboundStats[require].preemptiveExpandRateSum; r6 = a0.preemptiveExpandRate ?? value4; object.preemptiveExpandRateSum = preemptiveExpandRateSum + r6; object.speechExpandRateSum = env2_0.periodicInboundStats[require].speechExpandRateSum + (a0.speechExpandRate ?? value4); object.numRateSamples = env2_0.periodicInboundStats[require].numRateSamples + 1; periodicInboundStats[require] = object; } else { inboundStats = env2_0.inboundStats; object4 = {packetsReceived: packetsReceived, bytesReceived: bytesReceived, packetsLost: packetsLost}; r12 = nackCount ?? value4; object4.nackCount = r12; object4.fecPacketsReceived = r16; object4.fecPacketsDiscarded = r15; object4.mos = value4; object4.mosSum = value4; object4.mosCount = value4; object4.mosBuckets = [0, 0, 0, 0, 0]; object4.bufferStats = object; object4.frameOpStats = object2; copyDataProperties(object4, object3, undefined); inboundStats[require] = object4; periodicInboundStats = env2_0.periodicInboundStats; object = {}; performance = global.performance; object.previousTimestampMs = performance.now(); object.previous = object2; performance = global.performance; object.currentTimestampMs = performance.now(); object.current = object2; r12 = a0.accelerateRate ?? value4; object.accelerateRateSum = r12; r12 = a0.expandRate ?? value4; object.expandRateSum = r12; r12 = a0.preemptiveExpandRate ?? value4; object.preemptiveExpandRateSum = r12; r12 = a0.speechExpandRate ?? value4; object.speechExpandRateSum = r12; object.numRateSamples = 1; periodicInboundStats[require] = object; } } } } } } function value_94536() { // fn#94536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:8127, offset: 0x0211c3a8, size: 205 bytes, params: 1, frame: 16 var environment; let value = environment.__proto__; const reduce = (Module00022).reduce; const inboundStats = this.inboundStats; const value2 = 0; value = Reflect.apply(reduce, value, [inboundStats, function(a0, a1) { var property2; var property = a0.mosSum; a0.mosSum = property + a1.mosSum; a0.mosCount = a0.mosCount + a1.mosCount; var value = 0; var r2 = value; reducibleLoop1: while (true) { property = a0.mosBuckets; property2 = property[r2]; property[r2] = property2 + a1.mosBuckets[r2]; value = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value < 5) { r2 = value; continue reducibleLoop1; } break reducibleLoop1; } return a0; }, {'mosSum': 0, 'mosCount': 0, mosBuckets: [0, 0, 0, 0, 0]}]); return {mos_mean: value.mosCount > value2 ? value.mosSum / value.mosCount : value2, mos_1: value.mosBuckets[1], mos_2: value.mosBuckets[2], mos_3: value.mosBuckets[3], mos_4: value.mosBuckets[4]}; } function value_94538() { // fn#94538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:8510, offset: 0x0211c4d1, size: 177 bytes, params: 1, frame: 16 var environment; let value = environment.__proto__; value = Reflect.apply((importDefault(22) /* metro dependency 22 */).reduce, value, [this.inboundStats, function(a0, a1) { a0.packetsReceived = a0.packetsReceived + a1.packetsReceived; a0.packetsReceivedLost = a0.packetsReceivedLost + a1.packetsLost; a0.nackCount = a0.nackCount + a1.nackCount; a0.fecPacketsReceived = a0.fecPacketsReceived + a1.fecPacketsReceived; a0.fecPacketsDiscarded = a0.fecPacketsDiscarded + a1.fecPacketsDiscarded; return a0; }, {'packetsReceived': 0, 'packetsReceivedLost': 0, 'nackCount': 0, 'fecPacketsReceived': 0, 'fecPacketsDiscarded': 0}]); return {packets_sent: this.outboundStats.packetsSent, packets_sent_lost: this.outboundStats.packetsLost, packets_received: value.packetsReceived, packets_received_lost: value.packetsReceivedLost, num_nacks_sent: value.nackCount, fec_packets_received: value.fecPacketsReceived, fec_packets_discarded: value.fecPacketsDiscarded}; } function value_94540() { // fn#94540, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:9182, offset: 0x0211c5f8, size: 212 bytes, params: 1, frame: 20 var environment; let value = environment.__proto__; const reduce = (Module00022).reduce; const inboundStats = this.inboundStats; const value2 = 0; value = Reflect.apply(reduce, value, [inboundStats, function(a0, a1) { return a0 + a1.bytesReceived; }, value2]); const value3 = this.outboundStats.aggregationDurationMs / 1000; const object = {}; object.bytes_sent = this.outboundStats.bytesSent; object.bytes_received = value; value = value3 > value2; object.outbound_bandwidth_estimate = value ? global.Math.round(8 * this.outboundStats.bytesAvailable / value3) : value2; object.audio_target_bitrate = value ? global.Math.round(8 * this.outboundStats.bytesTarget / value3) : value2; return object; } function value_94544() { // fn#94544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:9732, offset: 0x0211c708, size: 358 bytes, params: 1, frame: 19 var audioJitterBuffer; var r0; var r8; var audioJitterTarget; var r7; var audioJitterDelay; var r5; const value2 = undefined; const defaultImport = Module00022; const reduce = defaultImport.reduce; const inboundStats = this.inboundStats; const value3 = null; const value4 = Reflect.apply(reduce, defaultImport, [inboundStats, _fun94545, value3]); if (value3 != value4) { if (value4.audioJitterBufferHistogram.getSamples() > 0) { r0 = value4.audioJitterBufferHistogram; } else { audioJitterBuffer = value4.audioJitterBuffer; audioJitterBuffer = value3 != audioJitterBuffer ? value4.audioJitterBuffer : value3; r0 = audioJitterBuffer; } r8 = r0; } else { r8 = value3; } if (value3 != value4) { if (value4.audioJitterTargetHistogram.getSamples() > 0) { r0 = value4.audioJitterTargetHistogram; } else { audioJitterTarget = value4.audioJitterTarget; audioJitterTarget = value3 != audioJitterTarget ? value4.audioJitterTarget : value3; r0 = audioJitterTarget; } r7 = r0; } else { r7 = value3; } if (value3 != value4) { if (value4.audioJitterDelayHistogram.getSamples() > 0) { r0 = value4.audioJitterDelayHistogram; } else { audioJitterDelay = value4.audioJitterDelay; audioJitterDelay = value3 != audioJitterDelay ? value4.audioJitterDelay : value3; r0 = audioJitterDelay; } r5 = r0; } else { r5 = value3; } const object = {}; const explodePlayoutMetricsBinding = explodePlayoutMetrics; const relativeReceptionDelay = value3 == value4 ? value2 : value4.relativeReceptionDelay; const relativePlayoutDelay = value3 == value4 ? value2 : value4.relativePlayoutDelay; copyDataProperties(object, explodePlayoutMetricsBinding({audio_jitter_buffer: r8, audio_jitter_target: r7, audio_jitter_delay: r5, relative_reception_delay: value3 != relativeReceptionDelay ? relativeReceptionDelay : value3, relative_playout_delay: value3 != relativePlayoutDelay ? relativePlayoutDelay : value3}), undefined); return object; } function value_94546() { // fn#94546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:10976, offset: 0x0211c94a, size: 165 bytes, params: 1, frame: 15 var environment; let value = environment.__proto__; value = Reflect.apply((importDefault(22) /* metro dependency 22 */).reduce, value, [this.inboundStats, _fun94547, {'silent': 0, 'normal': 0, 'merged': 0, 'expanded': 0, 'accelerated': 0, 'preemptiveExpanded': 0, 'cng': 0}]); return {frame_op_silent: value.silent, frame_op_normal: value.normal, frame_op_merged: value.merged, frame_op_expanded: value.expanded, frame_op_accelerated: value.accelerated, frame_op_preemptive_expanded: value.preemptiveExpanded, frame_op_cng: value.cng}; } function value_94550() { // fn#94550, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:12219, offset: 0x0211cb9d, size: 311 bytes, params: 1, frame: 16 var environment; let value = environment.__proto__; value = Reflect.apply((importDefault(22) /* metro dependency 22 */).reduce, value, [this.inboundStats, _fun94551, {'passthroughCount': 0, 'decryptSuccessCount': 0, 'decryptFailureCount': 0, 'decryptDuration': 0, 'decryptAttempts': 0, 'decryptMissingKeyCount': 0, 'decryptInvalidNonceCount': 0, 'decryptFailureAfterSuccessCount': 0}]); return {decrypt_passthrough_count: value.passthroughCount, decrypt_success_count: value.decryptSuccessCount, decrypt_failure_count: value.decryptFailureCount, decrypt_duration: value.decryptDuration, decrypt_attempts: value.decryptAttempts, decrypt_missing_key_count: value.decryptMissingKeyCount, decrypt_invalid_nonce_count: value.decryptInvalidNonceCount, decrypt_failure_after_success_count: value.decryptFailureAfterSuccessCount, encrypt_passthrough_count: this.outboundStats.passthroughCount, encrypt_success_count: this.outboundStats.encryptSuccessCount, encrypt_failure_count: this.outboundStats.encryptFailureCount, encrypt_duration: this.outboundStats.encryptDuration, encrypt_attempts: this.outboundStats.encryptAttempts, encrypt_max_attempts: this.outboundStats.encryptMaxAttempts, encrypt_missing_key_count: this.outboundStats.encryptMissingKeyCount}; } function value_94554() { // fn#94554, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:15461, offset: 0x0211cff8, size: 966 bytes, params: 1, frame: 69 var r18; var r48; var r47; var r56; var r57; var property; var value4; var property2; var previous; var current; var currentTimestampMs; var previousTimestampMs; var numRateSamples; var value5; var object; var silent; var value6; var normal; var value7; var merged; var value8; var expanded; var value9; var accelerated; var value10; var preemptiveExpanded; var value11; var cng; var value12; var accelerateRateSum; var expandRateSum; var preemptiveExpandRateSum; var speechExpandRateSum; var value13; var value14; var value15; var value16; const items2 = []; const Object = global.Object; const entries = Object.entries; let periodicInboundStats = this.periodicInboundStats; const value = Reflect.apply(entries, Object, [periodicInboundStats]); let length = value.length; const value2 = 0; if (value2 < length) { r18 = value2; while (true) { property = value[r18]; value4 = env1_3(property, 2); property = value4[value2]; property2 = value4[1]; previous = property2.previous; current = property2.current; currentTimestampMs = property2.currentTimestampMs; previousTimestampMs = property2.previousTimestampMs; numRateSamples = property2.numRateSamples; if (previousTimestampMs !== undefined) { if (currentTimestampMs > previousTimestampMs) { value5 = currentTimestampMs - previousTimestampMs; object = {userId: property}; silent = current.silent; if (silent != null) { r47 = silent; continue; } silent = previous.silent; if (silent != null) { r48 = silent; continue; } r48 = value2; continue; value6 = value2 - r48; r47 = value6; object.silent = r47; normal = current.normal; if (normal != null) { r47 = normal; continue; } normal = previous.normal; if (normal != null) { r48 = normal; continue; } r48 = value2; continue; value7 = value2 - r48; r47 = value7; object.normal = r47; merged = current.merged; if (merged != null) { r47 = merged; continue; } merged = previous.merged; if (merged != null) { r48 = merged; continue; } r48 = value2; continue; value8 = value2 - r48; r47 = value8; object.merged = r47; expanded = current.expanded; if (expanded != null) { r47 = expanded; continue; } expanded = previous.expanded; if (expanded != null) { r48 = expanded; continue; } r48 = value2; continue; value9 = value2 - r48; r47 = value9; object.expanded = r47; accelerated = current.accelerated; if (accelerated != null) { r47 = accelerated; continue; } accelerated = previous.accelerated; if (accelerated != null) { r48 = accelerated; continue; } r48 = value2; continue; value10 = value2 - r48; r47 = value10; object.accelerated = r47; preemptiveExpanded = current.preemptiveExpanded; if (preemptiveExpanded != null) { r47 = preemptiveExpanded; continue; } preemptiveExpanded = previous.preemptiveExpanded; if (preemptiveExpanded != null) { r56 = preemptiveExpanded; continue; } r56 = value2; continue; value11 = value2 - r56; r47 = value11; object.preemptiveExpanded = r47; cng = current.cng; if (cng != null) { r56 = cng; continue; } cng = previous.cng; if (cng != null) { r57 = cng; continue; } r57 = value2; continue; value12 = value2 - r57; r56 = value12; object.cng = r56; accelerateRateSum = property2.accelerateRateSum; object.accelerateRate = accelerateRateSum / numRateSamples; expandRateSum = property2.expandRateSum; object.expandRate = expandRateSum / numRateSamples; preemptiveExpandRateSum = property2.preemptiveExpandRateSum; object.preemptiveExpandRate = preemptiveExpandRateSum / numRateSamples; speechExpandRateSum = property2.speechExpandRateSum; object.speechExpandRate = speechExpandRateSum / numRateSamples; object.durationMs = value5; normal = object.normal; merged = object.merged; value13 = normal + merged; expanded = object.expanded; value14 = value13 + expanded; accelerated = object.accelerated; value15 = value14 + accelerated; preemptiveExpanded = object.preemptiveExpanded; if (value15 + preemptiveExpanded > value2) { items2.push(object); break; } break; } break; } periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].accelerateRateSum = value2; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].expandRateSum = value2; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].preemptiveExpandRateSum = value2; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].speechExpandRateSum = value2; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].numRateSamples = value2; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].previous = current; periodicInboundStats = this.periodicInboundStats; periodicInboundStats[property].previousTimestampMs = currentTimestampMs; value16 = typeof r18 === 'bigint' ? r18 + 1n : +r18 + 1; length = value.length; if (value16 < length) { r18 = value16; continue; } break; } } return items2; } } } function appendTargetRates(a0) { // fn#94527, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:1945, owner: VoiceQuality.appendTargetRates, offset: 0x0211b767, size: 182 bytes, params: 2, frame: 15 var performance; var aggregationDurationMs; var value3; let value = a1; const value2 = a2; const r4 = value !== undefined ? value : 0; const r6 = value2 !== undefined ? value2 : 0; let previousTimestampMs = a0.previousTimestampMs; if (previousTimestampMs !== 0) { value = global.performance.now(); aggregationDurationMs = a0.aggregationDurationMs; previousTimestampMs = a0.previousTimestampMs; a0.aggregationDurationMs = aggregationDurationMs + (value - previousTimestampMs); previousTimestampMs = a0.previousTimestampMs; value3 = (value - previousTimestampMs) / 1000; a0.bytesAvailable = a0.bytesAvailable + r4 / 8 * value3; a0.bytesTarget = a0.bytesTarget + r6 / 8 * value3; a0.previousTimestampMs = value; } else { performance = global.performance; a0.previousTimestampMs = performance.now(); } } function _fun94533(a0, {packetsReceived}) { // fn#94533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:7136, offset: 0x0211ba6c, size: 30 bytes, params: 3, frame: 3 const packetsReceived = a0.packetsReceived; a0.packetsReceived = packetsReceived + packetsReceived; return a0; } function _fun94545(a0, a1) { // fn#94545, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:9789, offset: 0x0211c86e, size: 220 bytes, params: 3, frame: 16 const value = a0; const r5 = a1.bufferStats.audioJitterBufferHistogram.getSamples() > 0 ? a1.bufferStats.audioJitterBufferHistogram.getPercentile(75) : a1.bufferStats.audioJitterBuffer != null ? a1.bufferStats.audioJitterBuffer.p75 : null; const value5 = null; const r4 = value5 == value ? value5 : value.audioJitterBufferHistogram.getSamples() > 0 ? value.audioJitterBufferHistogram.getPercentile(75) : value5 != value.audioJitterBuffer ? value.audioJitterBuffer.p75 : value5; let r2 = value5 == value || value5 == r4; r2 = !r2 ? value5 != r5 && r5 > r4 : r2; return r2 ? a1.bufferStats : value; } function _fun94547(a0, a1) { // fn#94547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:11029, offset: 0x0211c9ef, size: 318 bytes, params: 3, frame: 5 if (a1.frameOpStats.silent != null) { a0.silent = a0.silent + a1.frameOpStats.silent; } if (a1.frameOpStats.normal != null) { a0.normal = a0.normal + a1.frameOpStats.normal; } if (a1.frameOpStats.merged != null) { a0.merged = a0.merged + a1.frameOpStats.merged; } if (a1.frameOpStats.expanded != null) { a0.expanded = a0.expanded + a1.frameOpStats.expanded; } if (a1.frameOpStats.accelerated != null) { a0.accelerated = a0.accelerated + a1.frameOpStats.accelerated; } if (a1.frameOpStats.preemptiveExpanded != null) { a0.preemptiveExpanded = a0.preemptiveExpanded + a1.frameOpStats.preemptiveExpanded; } if (a1.frameOpStats.cng != null) { a0.cng = a0.cng + a1.frameOpStats.cng; } return a0; } function _fun94551(a0, a1) { // fn#94551, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:12272, offset: 0x0211ccd4, size: 304 bytes, params: 3, frame: 8 const passthroughCount = a0.passthroughCount; const passthroughCount2 = a1.passthroughCount; const value = 0; a0.passthroughCount = passthroughCount + (passthroughCount2 ?? value); a0.decryptSuccessCount = a0.decryptSuccessCount + (a1.decryptSuccessCount ?? value); a0.decryptFailureCount = a0.decryptFailureCount + (a1.decryptFailureCount ?? value); a0.decryptDuration = a0.decryptDuration + (a1.decryptDuration ?? value); a0.decryptAttempts = a0.decryptAttempts + (a1.decryptAttempts ?? value); a0.decryptMissingKeyCount = a0.decryptMissingKeyCount + (a1.decryptMissingKeyCount ?? value); a0.decryptInvalidNonceCount = a0.decryptInvalidNonceCount + (a1.decryptInvalidNonceCount ?? value); a0.decryptFailureAfterSuccessCount = a0.decryptFailureAfterSuccessCount + ((a1.decryptFailureCount ?? value) - (a1.decryptFailureBeforeSuccessCount ?? value)); return a0; } function value_94552() { // fn#94552, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:13869, offset: 0x0211ce04, size: 257 bytes, params: 1, frame: 7 const object = {}; let restartCount = this.inputDeviceStats.restartCount; const value = undefined; object.input_device_restart_count = restartCount == null ? value : restartCount.accumulated; restartCount = this.outputDeviceStats.restartCount; object.output_device_restart_count = restartCount == null ? value : restartCount.accumulated; object.input_device_time_to_first_audio = this.inputDeviceStats.timeToFirstCallbackMs; object.output_device_time_to_first_audio = this.outputDeviceStats.timeToFirstCallbackMs; let bufferViolations = this.inputDeviceStats.bufferViolations; object.input_device_buffer_overfull_count = bufferViolations == null ? value : bufferViolations.accumulated; bufferViolations = this.outputDeviceStats.bufferViolations; object.output_device_buffer_underrun_count = bufferViolations == null ? value : bufferViolations.accumulated; object.input_device_session_sample_rate = this.inputDeviceStats.sessionSampleRate; object.output_device_session_sample_rate = this.outputDeviceStats.sessionSampleRate; object.input_device_time_from_connect_to_first_audio_ms = this.inputDeviceStats.timeFromConnectToFirstCallbackMs; object.output_device_time_from_connect_to_first_audio_ms = this.outputDeviceStats.timeFromConnectToFirstCallbackMs; return object; } function value_94553() { // fn#94553, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12588:14848, offset: 0x0211cf05, size: 243 bytes, params: 1, frame: 12 const report = this.outboundStats.speakingAudioLevel.getReport([1, 5, 10, 25, 50, 75, 90, 95, 99]); return {outbound_audio_level_db_p1: report.percentiles[1], outbound_audio_level_db_p5: report.percentiles[5], outbound_audio_level_db_p10: report.percentiles[10], outbound_audio_level_db_p25: report.percentiles[25], outbound_audio_level_db_p50: report.percentiles[50], outbound_audio_level_db_p75: report.percentiles[75], outbound_audio_level_db_p90: report.percentiles[90], outbound_audio_level_db_p95: report.percentiles[95], outbound_audio_level_db_p99: report.percentiles[99], outbound_audio_level_db_max: report.max, outbound_audio_level_db_mean: report.mean}; } global.__d(_fun94518, 12402, [57, 6, 7, 15, 17, 18, 7131, 4303, 22, 12403, 7137, 4406, 4479, 2]) /* metro module 12402, dependencies: [57, 6, 7, 15, 17, 18, 7131, 4303, 22, 12403, 7137, 4406, 4479, 2] */;