Files
discord-decomp/sources/lib/VideoQualityStats.tsx
T
2026-07-28 01:06:53 +03:00

1076 lines
53 KiB
TypeScript

/* Metro module 7130; source: lib/VideoQualityStats.tsx; dependencies: [15, 17, 18, 57, 6, 7, 7131, 7137, 4303, 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 Module00057 from '../by-id/module-00057.js'; /* Metro dependency 57 */
import SystemResources from './SystemResources.tsx'; /* Metro dependency 7137 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as TimeUtilsModule from '../external/discord_common/js/packages/time-utils/TimeUtils.tsx'; /* Metro dependency 4303 */
import * as HistogramModule from './Histogram.tsx'; /* Metro dependency 7131 */
function _fun57001(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57001, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:6, offset: 0x013d8a8a, size: 1356 bytes, params: 8, frame: 32
const env0_0 = require;
const parseEncoder2 = parseEncoder;
const parseDecoder2 = parseDecoder;
const parseCodecType2 = parseCodecType;
let Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_9 = [0, 500000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000];
const env0_10 = [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60];
const env0_11 = [720, 480, 360];
const env0_12 = ['framesCodec', 'framesNetwork', 'packets', 'packetsLost', 'framesDropped', 'framesCodecError',
'bytes', 'nackCount', 'pliCount', 'qpSum', 'freezeCount', 'pauseCount', 'totalFreezesDuration',
'totalPausesDuration', 'totalFramesDuration', 'keyframes', 'passthroughCount', 'cryptorSuccessCount',
'cryptorFailureCount', 'cryptorDuration', 'cryptorAttempts', 'cryptorMissingKeyCount',
'cryptorInvalidNonceCount', 'qualityDecodeErrors', 'qualityDecoderReboots', 'qualityScoreErrors',
'qualityFrameDrops', 'qualitySizeMismatches', 'screenshareFramesUnique'];
const object2 = {NVIDIA_CUDA: 'nvidia_cuda', NVIDIA_DIRECT_3D: 'nvidia_direct_3d', NVIDIA_VULKAN: 'nvidia_vulkan',
OPENH264: 'openh264', VIDEOTOOLBOX: 'videotoolbox', AMD_DIRECT_3D: 'amd_direct_3d', AMD_VAAPI: 'amd_vaapi',
INTEL: 'intel', INTEL_DIRECT_3D: 'intel_direct_3d', INTEL_VAAPI: 'intel_vaapi', VP8_LIBVPX: 'vp8_libvpx',
EXYNOS: 'exynos', QUALCOMM: 'qualcomm', MEDIATEK: 'mediatek', WMF_SW: 'wmf_sw', WMF_HW: 'wmf_hw',
WMF_DIRECT_3D: 'wmf_direct_3d', WMF_DIRECT_3D_INTEL: 'wmf_direct_3d_intel',
WMF_DIRECT_3D_NVIDIA: 'wmf_direct_3d_nvidia', WMF_DIRECT_3D_AMD: 'wmf_direct_3d_amd', WMF_CHROME: 'wmf_chrome',
UNCATEGORIZED: 'uncategorized', UNKNOWN: 'unknown'};
const object3 = {VIDEOTOOLBOX: 'videotoolbox', VP8_LIBVPX: 'vp8_libvpx', ELECTRON: 'electron', FFMPEG: 'ffmpeg',
DAV1D: 'dav1d', WEBRTC: 'WebRTC', EXYNOS: 'exynos', QUALCOMM: 'qualcomm', MEDIATEK: 'mediatek',
UNCATEGORIZED: 'uncategorized', D3D11VIDEODECODER: 'd3d11videodecoder', UNKNOWN: 'unknown'};
Object = global.Object;
let freeze = Object.freeze;
const object4 = {};
const WMF_DIRECT_3D_INTEL = object2.WMF_DIRECT_3D_INTEL;
object4['mediafoundation direct3d intel'] = WMF_DIRECT_3D_INTEL;
const WMF_DIRECT_3D_NVIDIA = object2.WMF_DIRECT_3D_NVIDIA;
object4['mediafoundation direct3d nvidia'] = WMF_DIRECT_3D_NVIDIA;
const WMF_DIRECT_3D_AMD = object2.WMF_DIRECT_3D_AMD;
object4['mediafoundation direct3d amd'] = WMF_DIRECT_3D_AMD;
const WMF_CHROME = object2.WMF_CHROME;
object4.mediafoundationvideoencodeaccelerator = WMF_CHROME;
const NVIDIA_CUDA = object2.NVIDIA_CUDA;
object4['nvidia: cuda'] = NVIDIA_CUDA;
const NVIDIA_DIRECT_3D = object2.NVIDIA_DIRECT_3D;
object4['nvidia: direct3d'] = NVIDIA_DIRECT_3D;
const NVIDIA_VULKAN = object2.NVIDIA_VULKAN;
object4['nvidia: vulkan'] = NVIDIA_VULKAN;
const AMD_DIRECT_3D = object2.AMD_DIRECT_3D;
object4['amd: direct3d'] = AMD_DIRECT_3D;
const AMD_VAAPI = object2.AMD_VAAPI;
object4['amd: vaapi'] = AMD_VAAPI;
const INTEL_DIRECT_3D = object2.INTEL_DIRECT_3D;
object4['intel: direct3d'] = INTEL_DIRECT_3D;
const INTEL_VAAPI = object2.INTEL_VAAPI;
object4['intel: vaapi'] = INTEL_VAAPI;
const INTEL = object2.INTEL;
object4.intel = INTEL;
let VIDEOTOOLBOX = object2.VIDEOTOOLBOX;
object4.videotoolbox = VIDEOTOOLBOX;
const OPENH264 = object2.OPENH264;
object4.openh264 = OPENH264;
let VP8_LIBVPX = object2.VP8_LIBVPX;
object4.libvpx = VP8_LIBVPX;
let EXYNOS = object2.EXYNOS;
object4['c2.exynos'] = EXYNOS;
EXYNOS = object2.EXYNOS;
object4['omx.exynos'] = EXYNOS;
let QUALCOMM = object2.QUALCOMM;
object4['c2.qti'] = QUALCOMM;
QUALCOMM = object2.QUALCOMM;
object4['omx.qcom'] = QUALCOMM;
let MEDIATEK = object2.MEDIATEK;
object4['c2.mtk'] = MEDIATEK;
MEDIATEK = object2.MEDIATEK;
object4['omx.mtk'] = MEDIATEK;
const WMF_SW = object2.WMF_SW;
object4['mediafoundation sw'] = WMF_SW;
const WMF_HW = object2.WMF_HW;
object4['mediafoundation hw'] = WMF_HW;
const WMF_DIRECT_3D = object2.WMF_DIRECT_3D;
object4['mediafoundation direct3d'] = WMF_DIRECT_3D;
const env0_16 = Reflect.apply(freeze, Object, [object4]);
Object = global.Object;
freeze = Object.freeze;
const object5 = {};
VIDEOTOOLBOX = object3.VIDEOTOOLBOX;
object5.videotoolbox = VIDEOTOOLBOX;
VP8_LIBVPX = object3.VP8_LIBVPX;
object5.libvpx = VP8_LIBVPX;
const ELECTRON = object3.ELECTRON;
object5.electron = ELECTRON;
const FFMPEG = object3.FFMPEG;
object5.ffmpeg = FFMPEG;
const DAV1D = object3.DAV1D;
object5.dav1d = DAV1D;
const WEBRTC = object3.WEBRTC;
object5.webrtc = WEBRTC;
EXYNOS = object3.EXYNOS;
object5['c2.exynos'] = EXYNOS;
EXYNOS = object3.EXYNOS;
object5['omx.exynos'] = EXYNOS;
QUALCOMM = object3.QUALCOMM;
object5['c2.qti'] = QUALCOMM;
QUALCOMM = object3.QUALCOMM;
object5['omx.qcom'] = QUALCOMM;
MEDIATEK = object3.MEDIATEK;
object5['c2.mtk'] = MEDIATEK;
MEDIATEK = object3.MEDIATEK;
object5['omx.mtk'] = MEDIATEK;
const D3D11VIDEODECODER = object3.D3D11VIDEODECODER;
object5.d3d11videodecoder = D3D11VIDEODECODER;
const env0_17 = Reflect.apply(freeze, Object, [object5]);
const object6 = {None: 0};
object6[0] = 'None';
object6.ClientSideDisableVideo = 1;
object6[1] = 'ClientSideDisableVideo';
object6.SenderStopped = 2;
object6[2] = 'SenderStopped';
const value = _fun57008();
const value2 = _fun57012();
const value3 = _fun57029(value2);
(FileImportTrackerModule).fileFinishedImporting('lib/VideoQualityStats.tsx');
exports.CodecTypes = {H264: 'H264', H265: 'H265', VP8: 'VP8', VP9: 'VP9', AV1: 'AV1', UNKNOWN: 'UNKNOWN'};
exports.Encoders = object2;
exports.Decoders = object3;
exports.VideoStoppedReasons = object6;
exports.parseEncoder = parseEncoder2;
exports.parseDecoder = parseDecoder2;
exports.parseCodecType = parseCodecType2;
exports.RawVideoStats = value;
exports.InboundStats = value2;
exports.OutboundStats = value3;
function _isNativeReflectConstruct_57002() { // fn#57002, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:158, offset: 0x013d8fd6, size: 94 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_57002_isNativeReflectConstruct = function() {
return !!result;
})();
}
function parseEncoder(a0) { // fn#57005, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:3289, offset: 0x013d9034, size: 124 bytes, params: 2, frame: 15
var r3;
var property;
var toLowerCase;
var value4;
var includes;
var value5;
if (a0 == null) {
return env0_14.UNKNOWN;
}
const Object = global.Object;
const value2 = Object.keys(env0_16);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
r3 = value3;
loopExit2: while (true) {
property = value2[r3];
toLowerCase = a0.toLowerCase;
value4 = Reflect.apply(toLowerCase, a0, []);
includes = value4.includes;
if (Reflect.apply(includes, value4, [property])) {
return env0_16[property];
}
value5 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
length = value2.length;
if (value5 < length) {
r3 = value5;
continue;
}
break loopExit2;
}
}
return env0_14.UNCATEGORIZED;
}
function parseDecoder(a0) { // fn#57006, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:3464, offset: 0x013d90b0, size: 124 bytes, params: 2, frame: 15
var r3;
var property;
var toLowerCase;
var value4;
var includes;
var value5;
if (a0 == null) {
return env0_15.UNKNOWN;
}
const Object = global.Object;
const value2 = Object.keys(env0_17);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
r3 = value3;
loopExit2: while (true) {
property = value2[r3];
toLowerCase = a0.toLowerCase;
value4 = Reflect.apply(toLowerCase, a0, []);
includes = value4.includes;
if (Reflect.apply(includes, value4, [property])) {
return env0_17[property];
}
value5 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
length = value2.length;
if (value5 < length) {
r3 = value5;
continue;
}
break loopExit2;
}
}
return env0_15.UNCATEGORIZED;
}
function parseCodecType(a0) { // fn#57007, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:3639, offset: 0x013d912c, size: 177 bytes, params: 2, frame: 9
var r0;
var value;
if (a0 == null) {
r0 = env0_13.UNKNOWN;
} else {
value = a0.toUpperCase();
r0 = value === 'H264' ? env0_13.H264 : value === 'H265' ? env0_13.H265 : value === 'VP8' ? env0_13.VP8 : value === 'VP9' ? env0_13.VP9 : value === 'AV1' || value === 'AV1X' ? env0_13.AV1 : env0_13.UNKNOWN;
}
return r0;
}
function _fun57008() { // fn#57008, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:3821, offset: 0x013d91dd, size: 85 bytes, params: 1, frame: 16
return CreateClass(RawVideoStats, null, [{key: 'parseInboundStats', value: value_57010}, {key: 'parseOutboundStats',
value: value_57011}]);
function RawVideoStats() { // fn#57009, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:3832, offset: 0x013d9232, size: 307 bytes, params: 1, frame: 14
env1_7(this, RawVideoStats);
this.bytes = 0;
this.framesCodec = 0;
this.framesCodecError = null;
this.framesNetwork = 0;
this.resolution = 0;
this.minorResolution = 0;
this.majorResolution = 0;
this.timestamp = 0;
this.packets = 0;
this.packetsLost = 0;
this.framesDropped = 0;
this.nackCount = 0;
this.pliCount = 0;
this.encoder = null;
this.decoder = null;
this.codecType = null;
this.qpSum = 0;
this.freezeCount = 0;
this.pauseCount = 0;
this.totalFreezesDuration = 0;
this.totalPausesDuration = 0;
this.totalFramesDuration = 0;
this.vmafScore = null;
this.psnrDb = null;
this.outboundSinkWant = null;
this.keyframes = null;
this.framesDroppedRateLimiter = null;
this.framesDroppedEncoderQueue = null;
this.framesDroppedCongestionWindow = null;
this.framesDroppedEncoder = null;
this.passthroughCount = 0;
this.cryptorSuccessCount = 0;
this.cryptorFailureCount = 0;
this.cryptorDuration = 0;
this.cryptorAttempts = 0;
this.cryptorMaxAttempts = 0;
this.cryptorMissingKeyCount = 0;
this.cryptorInvalidNonceCount = 0;
this.qualityDecodeErrors = 0;
this.qualityDecoderReboots = 0;
this.qualityScoreErrors = 0;
this.qualityFrameDrops = 0;
this.qualitySizeMismatches = 0;
this.localWant = 0;
this.consecutiveStaticColorFrames = 0;
this.screenshareFramesUnique = 0;
}
function value_57010(a0, a1) { // fn#57010, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:5034, offset: 0x013d9365, size: 662 bytes, params: 3, frame: 18
var r1;
var height;
var r4;
var framesDecodeErrors;
var resolution;
var value3;
var Math;
var min;
var max;
var value6;
var keyFramesDecoded;
var passthroughCount;
var decryptSuccessCount;
var decryptFailureCount;
var decryptDuration;
var decryptAttempts;
var decryptMissingKeyCount;
var decryptInvalidNonceCount;
var sinkWantLocalAsInt;
const rawVideoStats = new RawVideoStats();
const value2 = null;
if (value2 != a0) {
rawVideoStats.bytes = a0.bytesReceived;
rawVideoStats.framesCodec = a0.framesDecoded;
framesDecodeErrors = a0.framesDecodeErrors;
r1 = value2 != framesDecodeErrors ? framesDecodeErrors : value2;
rawVideoStats.framesCodecError = r1;
rawVideoStats.framesNetwork = a0.framesReceived;
rawVideoStats.packets = a0.packetsReceived;
rawVideoStats.packetsLost = a0.packetsLost;
rawVideoStats.framesDropped = a0.framesDropped;
resolution = a0.resolution;
value3 = 0;
height = value2 != resolution ? a0.resolution.height : value3;
rawVideoStats.resolution = height;
resolution = a0.resolution;
if (value2 != resolution) {
Math = global.Math;
min = Math.min;
resolution = a0.resolution;
height = resolution.height;
resolution = a0.resolution;
r4 = Reflect.apply(min, Math, [height, resolution.width]);
} else {
r4 = value3;
}
rawVideoStats.minorResolution = r4;
resolution = a0.resolution;
if (value2 != resolution) {
Math = global.Math;
max = Math.max;
resolution = a0.resolution;
height = resolution.height;
resolution = a0.resolution;
r4 = Reflect.apply(max, Math, [height, resolution.width]);
} else {
r4 = value3;
}
rawVideoStats.majorResolution = r4;
rawVideoStats.timestamp = a1;
rawVideoStats.nackCount = a0.nackCount;
rawVideoStats.pliCount = a0.pliCount;
value6 = environment.__proto__;
rawVideoStats.decoder = parseDecoder(a0.decoderImplementationName);
rawVideoStats.codecType = parseCodecType(a0.codec.name);
rawVideoStats.qpSum = value3;
rawVideoStats.freezeCount = a0.freezeCount;
rawVideoStats.pauseCount = a0.pauseCount;
rawVideoStats.totalFreezesDuration = a0.totalFreezesDuration;
rawVideoStats.totalPausesDuration = a0.totalPausesDuration;
rawVideoStats.totalFramesDuration = a0.totalFramesDuration;
keyFramesDecoded = a0.keyFramesDecoded;
r4 = value2 != keyFramesDecoded ? keyFramesDecoded : value2;
rawVideoStats.keyframes = r4;
passthroughCount = a0.passthroughCount;
r4 = value2 != passthroughCount ? passthroughCount : value3;
rawVideoStats.passthroughCount = r4;
decryptSuccessCount = a0.decryptSuccessCount;
r4 = value2 != decryptSuccessCount ? decryptSuccessCount : value3;
rawVideoStats.cryptorSuccessCount = r4;
decryptFailureCount = a0.decryptFailureCount;
r4 = value2 != decryptFailureCount ? decryptFailureCount : value3;
rawVideoStats.cryptorFailureCount = r4;
decryptDuration = a0.decryptDuration;
r4 = value2 != decryptDuration ? decryptDuration : value3;
rawVideoStats.cryptorDuration = r4;
decryptAttempts = a0.decryptAttempts;
r4 = value2 != decryptAttempts ? decryptAttempts : value3;
rawVideoStats.cryptorAttempts = r4;
decryptMissingKeyCount = a0.decryptMissingKeyCount;
r4 = value2 != decryptMissingKeyCount ? decryptMissingKeyCount : value3;
rawVideoStats.cryptorMissingKeyCount = r4;
decryptInvalidNonceCount = a0.decryptInvalidNonceCount;
r4 = value2 != decryptInvalidNonceCount ? decryptInvalidNonceCount : value3;
rawVideoStats.cryptorInvalidNonceCount = r4;
sinkWantLocalAsInt = a0.sinkWantLocalAsInt;
r1 = value2 != sinkWantLocalAsInt ? sinkWantLocalAsInt : value3;
rawVideoStats.localWant = r1;
}
return rawVideoStats;
}
function value_57011(a0, a1) { // fn#57011, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:6454, offset: 0x013d95fb, size: 963 bytes, params: 3, frame: 19
var r5;
var height;
var r0;
var object;
var framesSent;
var packetsLost;
var resolution;
var Math;
var min;
var max;
var value5;
var freezeCount;
var totalFreezesDuration;
var totalFramesDuration;
var sinkWantAsInt;
var encoderQualityVmaf;
var qualityDecodeErrors;
var qualityDecoderReboots;
var qualityScoreErrors;
var qualityFrameDrops;
var qualitySizeMismatches;
var encoderQualityPsnr;
var keyFramesEncoded;
var framesDroppedRateLimiter;
var framesDroppedEncoderQueue;
var framesDroppedCongestionWindow;
var framesDroppedEncoder;
var passthroughCount;
var encryptSuccessCount;
var encryptFailureCount;
var encryptDuration;
var encryptAttempts;
var encryptMaxAttempts;
var encryptMissingKeyCount;
var consecutiveStaticColorFrames;
let rawVideoStats = new RawVideoStats();
const value2 = null;
if (value2 == a0) {
r0 = rawVideoStats;
} else {
object = {};
object.bytes = a0.bytesSent;
object.framesCodec = a0.framesEncoded;
object.framesCodecError = value2;
framesSent = a0.framesSent;
rawVideoStats = 0;
r5 = value2 != framesSent ? framesSent : rawVideoStats;
object.framesNetwork = r5;
object.packets = a0.packetsSent;
packetsLost = a0.packetsLost;
r5 = value2 != packetsLost ? packetsLost : rawVideoStats;
object.packetsLost = r5;
object.framesDropped = rawVideoStats;
resolution = a0.resolution;
height = value2 != resolution ? a0.resolution.height : rawVideoStats;
object.resolution = height;
resolution = a0.resolution;
if (value2 != resolution) {
Math = global.Math;
min = Math.min;
resolution = a0.resolution;
height = resolution.height;
resolution = a0.resolution;
r5 = Reflect.apply(min, Math, [height, resolution.width]);
} else {
r5 = rawVideoStats;
}
object.minorResolution = r5;
resolution = a0.resolution;
if (value2 != resolution) {
Math = global.Math;
max = Math.max;
resolution = a0.resolution;
height = resolution.height;
resolution = a0.resolution;
r5 = Reflect.apply(max, Math, [height, resolution.width]);
} else {
r5 = rawVideoStats;
}
object.majorResolution = r5;
object.timestamp = a1;
value5 = environment.__proto__;
object.encoder = parseEncoder(a0.encoderImplementationName);
object.decoder = value2;
object.codecType = parseCodecType(a0.codec.name);
object.nackCount = a0.nackCount;
object.pliCount = a0.pliCount;
object.qpSum = a0.qpSum;
freezeCount = a0.freezeCount;
r5 = value2 != freezeCount ? freezeCount : rawVideoStats;
object.freezeCount = r5;
object.pauseCount = rawVideoStats;
totalFreezesDuration = a0.totalFreezesDuration;
r5 = value2 != totalFreezesDuration ? totalFreezesDuration : rawVideoStats;
object.totalFreezesDuration = r5;
object.totalPausesDuration = rawVideoStats;
totalFramesDuration = a0.totalFramesDuration;
r5 = value2 != totalFramesDuration ? totalFramesDuration : rawVideoStats;
object.totalFramesDuration = r5;
sinkWantAsInt = a0.sinkWantAsInt;
r5 = value2 != sinkWantAsInt ? sinkWantAsInt : value2;
object.outboundSinkWant = r5;
encoderQualityVmaf = a0.encoderQualityVmaf;
r5 = value2 != encoderQualityVmaf ? encoderQualityVmaf : value2;
object.vmafScore = r5;
qualityDecodeErrors = a0.qualityDecodeErrors;
r5 = value2 != qualityDecodeErrors ? qualityDecodeErrors : rawVideoStats;
object.qualityDecodeErrors = r5;
qualityDecoderReboots = a0.qualityDecoderReboots;
r5 = value2 != qualityDecoderReboots ? qualityDecoderReboots : rawVideoStats;
object.qualityDecoderReboots = r5;
qualityScoreErrors = a0.qualityScoreErrors;
r5 = value2 != qualityScoreErrors ? qualityScoreErrors : rawVideoStats;
object.qualityScoreErrors = r5;
qualityFrameDrops = a0.qualityFrameDrops;
r5 = value2 != qualityFrameDrops ? qualityFrameDrops : rawVideoStats;
object.qualityFrameDrops = r5;
qualitySizeMismatches = a0.qualitySizeMismatches;
r5 = value2 != qualitySizeMismatches ? qualitySizeMismatches : rawVideoStats;
object.qualitySizeMismatches = r5;
encoderQualityPsnr = a0.encoderQualityPsnr;
r5 = value2 != encoderQualityPsnr ? encoderQualityPsnr : value2;
object.psnrDb = r5;
keyFramesEncoded = a0.keyFramesEncoded;
r5 = value2 != keyFramesEncoded ? keyFramesEncoded : value2;
object.keyframes = r5;
framesDroppedRateLimiter = a0.framesDroppedRateLimiter;
r5 = value2 != framesDroppedRateLimiter ? framesDroppedRateLimiter : value2;
object.framesDroppedRateLimiter = r5;
framesDroppedEncoderQueue = a0.framesDroppedEncoderQueue;
r5 = value2 != framesDroppedEncoderQueue ? framesDroppedEncoderQueue : value2;
object.framesDroppedEncoderQueue = r5;
framesDroppedCongestionWindow = a0.framesDroppedCongestionWindow;
r5 = value2 != framesDroppedCongestionWindow ? framesDroppedCongestionWindow : value2;
object.framesDroppedCongestionWindow = r5;
framesDroppedEncoder = a0.framesDroppedEncoder;
r5 = value2 != framesDroppedEncoder ? framesDroppedEncoder : value2;
object.framesDroppedEncoder = r5;
passthroughCount = a0.passthroughCount;
r5 = value2 != passthroughCount ? passthroughCount : rawVideoStats;
object.passthroughCount = r5;
encryptSuccessCount = a0.encryptSuccessCount;
r5 = value2 != encryptSuccessCount ? encryptSuccessCount : rawVideoStats;
object.cryptorSuccessCount = r5;
encryptFailureCount = a0.encryptFailureCount;
r5 = value2 != encryptFailureCount ? encryptFailureCount : rawVideoStats;
object.cryptorFailureCount = r5;
encryptDuration = a0.encryptDuration;
r5 = value2 != encryptDuration ? encryptDuration : rawVideoStats;
object.cryptorDuration = r5;
encryptAttempts = a0.encryptAttempts;
r5 = value2 != encryptAttempts ? encryptAttempts : rawVideoStats;
object.cryptorAttempts = r5;
encryptMaxAttempts = a0.encryptMaxAttempts;
r5 = value2 != encryptMaxAttempts ? encryptMaxAttempts : rawVideoStats;
object.cryptorMaxAttempts = r5;
encryptMissingKeyCount = a0.encryptMissingKeyCount;
r5 = value2 != encryptMissingKeyCount ? encryptMissingKeyCount : rawVideoStats;
object.cryptorMissingKeyCount = r5;
object.cryptorInvalidNonceCount = rawVideoStats;
object.localWant = rawVideoStats;
consecutiveStaticColorFrames = a0.consecutiveStaticColorFrames;
object.consecutiveStaticColorFrames = value2 != consecutiveStaticColorFrames ? consecutiveStaticColorFrames : rawVideoStats;
object.screenshareFramesUnique = rawVideoStats;
r0 = object;
}
return r0;
}
}
function _fun57012() { // fn#57012, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:8606, offset: 0x013d99be, size: 222 bytes, params: 1, frame: 15
return CreateClass(InboundStats, [{key: 'isVideoStopped', get: get_57018}, {key: 'videoStoppedDuration',
get: function() {
return this.videoStoppedWatch.elapsed();
}}, {key: 'collectAggregationStats', value: value_57020}, {key: 'setVideoStopped', value: value_57021},
{key: 'appendAndIncrementStats', value: value_57022}, {key: 'addSystemResources', value: function() {
this.systemResources.takeSample();
}}, {key: 'appendTransportStats', value: function(a0) {
if (a0.inboundBitrateEstimate != null) {
this.inboundBitrateEstimateHistogram.addSample(a0.inboundBitrateEstimate);
}
}}, {key: 'getCodecsUsed', value: value_57028}]);
function InboundStats(a0) { // fn#57013, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:8627, offset: 0x013d9a9c, size: 639 bytes, params: 2, frame: 20
env1_7(this, InboundStats);
const Object = global.Object;
const fromEntries = Object.fromEntries;
const Object2 = global.Object;
const value3 = Object2.values(env1_15);
this.decoderBuckets = Reflect.apply(fromEntries, Object, [value3.map(function(a0) {
return [a0, 0];
})]);
this.codecBuckets = {'H264': 0, 'H265': 0, 'VP8': 0, 'VP9': 0, 'AV1': 0, 'UNKNOWN': 0};
this.statsWindow = [];
const Histogram = (HistogramModule).Histogram;
const value4 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
let histogram = new Histogram();
this.fpsHistogram = histogram instanceof Object ? histogram : value4;
const value6 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
this.bitrateHistogram = histogram instanceof Object ? histogram : value6;
const value8 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
this.inboundBitrateEstimateHistogram = histogram instanceof Object ? histogram : value8;
const value10 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
this.resolutionHistogram = histogram instanceof Object ? histogram : value10;
const value12 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
this.localWantHistogram = histogram instanceof Object ? histogram : value12;
const defaultImport = SystemResources;
const value14 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
const defaultImport2 = new defaultImport();
this.systemResources = defaultImport2 instanceof Object ? defaultImport2 : value14;
const UNKNOWN = env1_13.UNKNOWN;
this.decoderCodec = UNKNOWN;
this.aggregatedProperties = {'framesCodec': 0, 'framesNetwork': 0, 'packets': 0, 'packetsLost': 0,
'framesDropped': 0, 'framesCodecError': 0, 'bytes': 0, 'nackCount': 0, 'pliCount': 0, 'qpSum': 0,
'freezeCount': 0, 'pauseCount': 0, 'totalFreezesDuration': 0, 'totalPausesDuration': 0,
'totalFramesDuration': 0, 'keyframes': 0, 'passthroughCount': 0, 'cryptorSuccessCount': 0,
'cryptorFailureCount': 0, 'cryptorDuration': 0, 'cryptorAttempts': 0, 'cryptorMissingKeyCount': 0,
'cryptorInvalidNonceCount': 0, 'qualityDecodeErrors': 0, 'qualityDecoderReboots': 0, 'qualityScoreErrors': 0,
'qualityFrameDrops': 0, 'qualitySizeMismatches': 0, 'screenshareFramesUnique': 0};
this.aggregationDuration = 0;
this.bitrateBuckets = {};
this.fpsBuckets = {};
this.resolutionBuckets = {};
this.resolutionTotal = 0;
this.minorResolutionTotal = 0;
this.majorResolutionTotal = 0;
this.intervalTotal = 0;
this.cryptorMaxAttempts = 0;
this.minWidth = null;
this.minHeight = null;
this.maxConsecutiveStaticColorFrames = 0;
const None = env1_18.None;
this.videoStoppedReason = None;
this.startTime = a0.now();
const StopWatch = (TimeUtilsModule).StopWatch;
const value17 = Object.create(StopWatch.prototype, {constructor: {value: StopWatch}});
const stopWatch = new StopWatch(a0);
this.videoStoppedWatch = stopWatch instanceof Object ? stopWatch : value17;
env1_9.forEach(_fun57015);
env1_10.forEach(_fun57016);
env1_11.forEach(_fun57017);
function _fun57015(a0) { // fn#57015, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10094, offset: 0x013d9d2e, size: 26 bytes, params: 2, frame: 3
env0_0.bitrateBuckets[a0] = 0;
}
function _fun57016(a0) { // fn#57016, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10137, offset: 0x013d9d48, size: 26 bytes, params: 2, frame: 3
env0_0.fpsBuckets[a0] = 0;
}
function _fun57017(a0) { // fn#57017, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10176, offset: 0x013d9d62, size: 26 bytes, params: 2, frame: 3
env0_0.resolutionBuckets[a0] = 0;
}
}
function get_57018() { // fn#57018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10240, offset: 0x013d9d7c, size: 28 bytes, params: 1, frame: 2
const videoStoppedReason = this.videoStoppedReason;
const None = env1_18.None;
return videoStoppedReason !== None;
}
function value_57020(a0, a1) { // fn#57020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10415, offset: 0x013d9dad, size: 149 bytes, params: 3, frame: 18
var r7;
var r3;
var r12;
var property;
var property2;
var property3;
var aggregatedProperties;
var property4;
var value2;
var value3;
let value = environment.__proto__;
const binding = env1_12;
let length = binding.length;
value = 0;
if (value < length) {
r7 = value;
while (true) {
property = binding[r7];
property2 = a0[property];
if (property2 !== null) {
property3 = a1[property];
if (property3 != null) {
r3 = property3;
continue;
}
r3 = value;
continue;
aggregatedProperties = this.aggregatedProperties;
property4 = aggregatedProperties[property];
if (r3 > property2) {
r12 = property2;
continue;
}
value2 = property2 - r3;
r12 = value2;
aggregatedProperties[property] = property4 + r12;
}
value3 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
length = binding.length;
if (value3 < length) {
r7 = value3;
continue;
}
break;
}
}
this.aggregationDuration = this.aggregationDuration + (a0.timestamp - a1.timestamp);
}
function value_57021(a0, a1) { // fn#57021, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10641, offset: 0x013d9e42, size: 122 bytes, params: 3, frame: 14
let videoStoppedReason = this.videoStoppedReason;
if (a0) {
this.videoStoppedReason = videoStoppedReason | a1;
this.videoStoppedWatch.start();
} else {
this.videoStoppedReason = videoStoppedReason & ~a1;
videoStoppedReason = this.videoStoppedReason;
var None = env1_18.None;
if (videoStoppedReason === None) {
this.statsWindow.splice(0);
this.videoStoppedWatch.stop();
}
}
}
function value_57022(a0) { // fn#57022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:10890, offset: 0x013d9ebc, size: 1137 bytes, params: 2, frame: 30
var environment;
var r15;
var r4;
var statsWindow;
var length;
var property;
var property2;
var cryptorSuccessCount;
var value;
var bytes;
var framesCodec;
var timestamp;
var resolution;
var minorResolution;
var majorResolution;
var encoder;
var decoder;
var codecType;
var localWant;
var Math;
var vmafScore;
var vmafScoreSum;
var vmafHistogram;
var addSample;
var psnrDb;
var psnrDbSum;
var psnrHistogram;
var bytes2;
var framesCodec2;
var timestamp3;
var binding;
var value11;
var value12;
var value13;
if (!this.isVideoStopped) {
statsWindow = this.statsWindow;
statsWindow.push(a0);
statsWindow = this.statsWindow;
length = statsWindow.length;
if (!(length < 2)) {
statsWindow = this.statsWindow;
length = this.statsWindow.length;
property = statsWindow[length - 1];
statsWindow = this.statsWindow;
length = this.statsWindow.length;
property2 = statsWindow[length - 2];
this.collectAggregationStats(property, property2);
if (this.cryptorFailureBeforeSuccessCount == null) {
cryptorSuccessCount = a0.cryptorSuccessCount;
value = 0;
if (cryptorSuccessCount > value) {
this.cryptorFailureBeforeSuccessCount = this.aggregatedProperties.cryptorFailureCount ?? value;
}
}
bytes = property.bytes;
framesCodec = property.framesCodec;
timestamp = property.timestamp;
resolution = property.resolution;
minorResolution = property.minorResolution;
majorResolution = property.majorResolution;
encoder = property.encoder;
decoder = property.decoder;
codecType = property.codecType;
localWant = property.localWant;
value = (timestamp - property2.timestamp) / 1000;
this.intervalTotal = this.intervalTotal + value;
this.resolutionTotal = this.resolutionTotal + resolution * value;
this.minorResolutionTotal = this.minorResolutionTotal + minorResolution * value;
this.majorResolutionTotal = this.majorResolutionTotal + majorResolution * value;
Math = global.Math;
this.cryptorMaxAttempts = Math.max(this.cryptorMaxAttempts, property.cryptorMaxAttempts);
if (encoder != null) {
if (codecType != null) {
if ('encoderBuckets' in this) {
this.encoderBuckets[encoder] += value;
this.codecBuckets[codecType] += value;
r15 = property.codecType != null && property.codecType !== env1_13.UNKNOWN;
if (r15) {
this.encoderCodec = property.codecType;
}
vmafScore = a0.vmafScore;
r15 = vmafScore != null && a0.vmafScore >= 0;
if (r15) {
this.vmafScoreNum = this.vmafScoreNum + 1;
vmafScoreSum = this.vmafScoreSum;
vmafScore = a0.vmafScore;
this.vmafScoreSum = vmafScoreSum + vmafScore;
vmafHistogram = this.vmafHistogram;
addSample = vmafHistogram.addSample;
vmafScore = a0.vmafScore;
Reflect.apply(addSample, vmafHistogram, [vmafScore]);
}
psnrDb = a0.psnrDb;
r15 = psnrDb != null && a0.psnrDb >= 0;
if (r15) {
this.psnrDbNum = this.psnrDbNum + 1;
psnrDbSum = this.psnrDbSum;
psnrDb = a0.psnrDb;
this.psnrDbSum = psnrDbSum + psnrDb;
psnrHistogram = this.psnrHistogram;
addSample = psnrHistogram.addSample;
psnrDb = a0.psnrDb;
Reflect.apply(addSample, psnrHistogram, [psnrDb]);
}
r15 = a0.outboundSinkWant != null && a0.outboundSinkWant !== 0;
if (r15) {
this.outboundSinkWantNum = this.outboundSinkWantNum + 1;
this.outboundSinkWantSum = this.outboundSinkWantSum + a0.outboundSinkWant;
}
Math = global.Math;
this.consecutiveStaticColorFramesMax = Math.max(this.consecutiveStaticColorFramesMax,
a0.consecutiveStaticColorFrames);
}
}
}
if (decoder != null) {
if (codecType != null) {
if ('decoderBuckets' in this) {
this.decoderBuckets[decoder] += value;
this.codecBuckets[codecType] += value;
codecType = property.codecType;
value = codecType != null;
if (value) {
codecType = property.codecType;
value = environment.__proto__;
value = codecType !== env1_13.UNKNOWN;
r4 = value;
} else {
r4 = value;
}
if (r4) {
this.decoderCodec = property.codecType;
}
}
}
}
statsWindow = this.statsWindow;
length = statsWindow.length;
if (!(length < 6)) {
statsWindow = this.statsWindow;
property = statsWindow[this.statsWindow.length - 3];
bytes2 = property.bytes;
framesCodec2 = property.framesCodec;
timestamp3 = property.timestamp;
value = environment.__proto__;
binding = env1_11;
binding.forEach(_fun57023);
value11 = (timestamp - timestamp3) / 1000;
value12 = 8 * (bytes - bytes2) / value11;
value13 = (framesCodec - framesCodec2) / value11;
binding = env1_9;
binding.forEach(_fun57024);
binding = env1_10;
binding.forEach(_fun57025);
this.resolutionHistogram.addSample(resolution);
this.bitrateHistogram.addSample(value12);
this.fpsHistogram.addSample(value13);
this.localWantHistogram.addSample(localWant);
statsWindow = this.statsWindow;
statsWindow.shift();
}
}
}
function _fun57023(a0) { // fn#57023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:12583, offset: 0x013da32d, size: 44 bytes, params: 2, frame: 4
var resolutionBuckets;
if (resolution <= a0) {
resolutionBuckets = env0_0.resolutionBuckets;
resolutionBuckets[a0] = resolutionBuckets[a0] + env0_2;
}
}
function _fun57024(a0) { // fn#57024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:12676, offset: 0x013da359, size: 44 bytes, params: 2, frame: 4
var bitrateBuckets;
if (PossibleConstructorReturn <= a0) {
bitrateBuckets = env0_0.bitrateBuckets;
bitrateBuckets[a0] = bitrateBuckets[a0] + env0_2;
}
}
function _fun57025(a0) { // fn#57025, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:12728, offset: 0x013da385, size: 44 bytes, params: 2, frame: 4
var fpsBuckets;
if (Module00017 <= a0) {
fpsBuckets = env0_0.fpsBuckets;
fpsBuckets[a0] = fpsBuckets[a0] + env0_2;
}
}
}
function value_57028() { // fn#57028, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:13194, offset: 0x013da3f5, size: 131 bytes, params: 1, frame: 19
var r2;
var property;
var value5;
var value6;
const Set = global.Set;
const set = new Set();
const Object = global.Object;
const value2 = Object.entries(this.codecBuckets);
let length = value2.length;
const value3 = 0;
if (value3 < length) {
r2 = value3;
while (true) {
property = value2[r2];
value5 = env1_6(property, 2);
property = value5[value3];
if (value5[1] > value3) {
set.add(property);
}
value6 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
length = value2.length;
if (value6 < length) {
r2 = value6;
continue;
}
break;
}
}
return set;
}
}
function _fun57029(a0) { // fn#57029, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:13341, offset: 0x013da478, size: 68 bytes, params: 2, frame: 15
const OutboundStats2 = OutboundStats;
Inherits(OutboundStats2, a0);
return CreateClass(OutboundStats2, [{key: 'appendTargetRates', value: value_57032}]);
function OutboundStats(a0) { // fn#57030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:13353, offset: 0x013da4bc, size: 509 bytes, params: 2, frame: 21
var r0;
var Reflect;
let value = copyRestArgs(0, undefined);
let binding = env1_7;
binding(this, OutboundStats);
const items2 = [];
arraySpread(items2, value, 0, items2);
value = env1_4(OutboundStats);
binding = env1_3;
if (_isNativeReflectConstruct_57002()) {
Reflect = global.Reflect;
value = Reflect.construct(value, items2, env1_4(this).constructor);
r0 = value;
} else {
value = value.apply(this, items2);
r0 = value;
}
value = binding(this, r0);
const Object = global.Object;
const fromEntries = Object.fromEntries;
const Object2 = global.Object;
const value4 = Object2.values(env1_14);
value.encoderBuckets = Reflect.apply(fromEntries, Object, [value4.map(function(a0) {
return [a0, 0];
})]);
const UNKNOWN = env1_13.UNKNOWN;
value.encoderCodec = UNKNOWN;
value.targetFrames = 0;
value.targetBytesMax = 0;
value.targetBytesNetwork = 0;
const Histogram = (HistogramModule).Histogram;
const value5 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
let histogram = new Histogram();
value.targetBitrateHistogram = histogram instanceof Object ? histogram : value5;
value.outboundBytesAvailable = 0;
const value7 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
value.outboundBandwidthSurplus = histogram instanceof Object ? histogram : value7;
value.averageEncodeTime = 0;
value.vmafScoreSum = 0;
value.vmafScoreNum = 0;
const value9 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
value.vmafHistogram = histogram instanceof Object ? histogram : value9;
value.psnrDbSum = 0;
value.psnrDbNum = 0;
const value11 = Object.create(Histogram.prototype, {constructor: {value: Histogram}});
histogram = new Histogram();
value.psnrHistogram = histogram instanceof Object ? histogram : value11;
value.qualityDecodeErrors = 0;
value.qualityDecoderReboots = 0;
value.qualityScoreErrors = 0;
value.qualityFrameDrops = 0;
value.qualitySizeMismatches = 0;
value.outboundSinkWantSum = 0;
value.outboundSinkWantNum = 0;
value.framesDroppedRateLimiter = null;
value.framesDroppedEncoderQueue = null;
value.framesDroppedCongestionWindow = null;
value.framesDroppedEncoder = null;
value.consecutiveStaticColorFramesMax = 0;
return value;
}
}
}
function value_57032(a0, a1, a2, a3) { // fn#57032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7308:14430, offset: 0x013da6b9, size: 302 bytes, params: 5, frame: 18
var r2;
var r0;
var r4;
var r3;
var value5;
var timestamp;
let value = a0;
const value2 = a1;
const value3 = a2;
const value4 = a3;
let statsWindow = this.statsWindow;
let length = statsWindow.length;
if (!(length < 2)) {
value5 = 0;
r2 = value ?? value5;
r0 = value2 ?? value5;
r4 = value3 ?? value5;
r3 = value4 ?? value5;
statsWindow = this.statsWindow;
length = this.statsWindow.length;
timestamp = statsWindow[length - 1].timestamp;
statsWindow = this.statsWindow;
length = this.statsWindow.length;
value = (timestamp - statsWindow[length - 2].timestamp) / 1000;
this.targetFrames = this.targetFrames + r2 * value;
this.targetBytesNetwork = this.targetBytesNetwork + r0 / 8 * value;
this.targetBytesMax = this.targetBytesMax + r4 / 8 * value;
this.outboundBytesAvailable = this.outboundBytesAvailable + r3 / 8 * value;
this.targetBitrateHistogram.addSample(r0);
this.outboundBandwidthSurplus.addSample(r3 - r0);
}
}
global.__d(_fun57001, 7130, [15, 17, 18, 57, 6, 7, 7131, 7137, 4303,
2]) /* metro module 7130, dependencies: [15, 17, 18, 57, 6, 7, 7131, 7137, 4303, 2] */;