Files
discord-decomp/sources/modules/go_live/VideoStreamStats.tsx
T
2026-07-28 01:06:53 +03:00

148 lines
8.6 KiB
TypeScript

/* Metro module 4404; source: modules/go_live/VideoStreamStats.tsx; dependencies: [6, 7, 4399, 661, 4041, 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 ApplicationStreamingSettingsStore from '../../stores/ApplicationStreamingSettingsStore.tsx'; /* Metro dependency 4399 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
import * as TimersModule from '../../external/discord_common/js/packages/timers/Timers.tsx'; /* Metro dependency 4041 */
function _fun37427(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#37427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:6, offset: 0x010a4d15, size: 179 bytes, params: 8, frame: 19
const env0_0 = require;
const round = function(a0) {
var r0;
var value = a1;
r0 = value !== undefined ? value : 0;
r0 = a0 != null ? global.Math.round(a0) : r0;
return r0;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = _fun37429();
(FileImportTrackerModule).fileFinishedImporting('modules/go_live/VideoStreamStats.tsx');
exports.default = value;
function _fun37429() { // fn#37429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:209, offset: 0x010a4df0, size: 172 bytes, params: 1, frame: 15
return CreateClass(VideoStreamStats, [{key: 'start', value: value_37433}, {key: 'stop', value: value_37434},
{key: 'autoQualityChange', value: function() {
this._automaticQualityChanges += 1;
}}, {key: 'layoutChange', value: value_37436}, {key: 'getLayout', value: function() {
return this._lastLayout;
}}, {key: 'getStats', value: value_37438}]);
function VideoStreamStats(a0, a1) { // fn#37430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:230, offset: 0x010a4e9c, size: 173 bytes, params: 3, frame: 15
var environment;
const value = environment.__proto__;
env1_2(this, VideoStreamStats);
this._targetResolution = 0;
this._targetFPS = 0;
this._streamSettingsChanged = false;
this._lastLayoutChanged = 0;
this._layoutChanges = 0;
this._automaticQualityChanges = 0;
this._incrementLayout = _incrementLayout;
this._sampleStats = _sampleStats;
this._isSender = a1;
const Interval = (TimersModule).Interval;
this._statInterval = new Interval();
this._lastLayout = a0;
this._layoutBuckets = {};
function _incrementLayout(a0, a1) { // fn#37431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:462, owner: VideoStreamStats._incrementLayout, offset: 0x010a4f49, size: 71 bytes, params: 3, frame: 4
if (env0_0._layoutBuckets[a0] == null) {
env0_0._layoutBuckets[a0] = 0;
}
env0_0._layoutBuckets[a0] += a1;
}
function _sampleStats() { // fn#37432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:572, owner: VideoStreamStats._sampleStats, offset: 0x010a4f90, size: 73 bytes, params: 1, frame: 12
let value = environment.__proto__.__proto__;
value = ApplicationStreamingSettingsStore.getState();
const resolution = value.resolution;
const fps = value.fps;
const binding = env0_0;
binding._streamSettingsChanged = resolution !== binding._targetResolution || fps !== env0_0._targetFPS;
}
}
function value_37433() { // fn#37433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:818, offset: 0x010a4fd9, size: 112 bytes, params: 1, frame: 15
let value = environment.__proto__;
const {resolution, fps} = ApplicationStreamingSettingsStore.getState();
this._targetResolution = resolution;
this._targetFPS = fps;
const _statInterval = this._statInterval;
_statInterval.start(1000, this._sampleStats);
value = require(4303) /* metro dependency 4303: TimeUtils */;
this._lastLayoutChanged = value.now();
}
function value_37434() { // fn#37434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:1020, offset: 0x010a5049, size: 105 bytes, params: 1, frame: 15
this._statInterval.stop();
let value = environment.__proto__;
value = require(4303) /* metro dependency 4303: TimeUtils */;
this._streamEnd = value.now();
this._incrementLayout(this._lastLayout, (this._streamEnd - this._lastLayoutChanged) / 1000);
}
function value_37436(a0) { // fn#37436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:1278, offset: 0x010a50cc, size: 131 bytes, params: 2, frame: 16
var value;
var _layoutChanges;
if (a0 !== this._lastLayout) {
if (this._streamEnd == null) {
value = environment.__proto__;
value = require(4303) /* metro dependency 4303: TimeUtils */;
value = value.now();
this._incrementLayout(this._lastLayout, (value - this._lastLayoutChanged) / 1000);
_layoutChanges = this._layoutChanges;
this._layoutChanges = typeof _layoutChanges === 'bigint' ? _layoutChanges + 1n : +_layoutChanges + 1;
this._lastLayout = a0;
this._lastLayoutChanged = value;
}
}
}
function value_37438() { // fn#37438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4576:1582, offset: 0x010a515a, size: 324 bytes, params: 1, frame: 16
var r0;
var object;
const object2 = {};
object2.num_layout_changes = this._layoutChanges;
const roundBinding = round;
let _layoutBuckets = this._layoutBuckets;
const FULL_SCREEN = StreamLayouts.FULL_SCREEN;
object2.duration_layout_fullscreen = roundBinding(_layoutBuckets[FULL_SCREEN]);
_layoutBuckets = this._layoutBuckets;
const THEATRE = StreamLayouts.THEATRE;
object2.duration_layout_theatre = roundBinding(_layoutBuckets[THEATRE]);
_layoutBuckets = this._layoutBuckets;
const PIP = StreamLayouts.PIP;
object2.duration_layout_pip = roundBinding(_layoutBuckets[PIP]);
_layoutBuckets = this._layoutBuckets;
const POPOUT = StreamLayouts.POPOUT;
object2.duration_layout_popout = roundBinding(_layoutBuckets[POPOUT]);
_layoutBuckets = this._layoutBuckets;
const PORTRAIT = StreamLayouts.PORTRAIT;
object2.duration_layout_portrait = roundBinding(_layoutBuckets[PORTRAIT]);
_layoutBuckets = this._layoutBuckets;
const LANDSCAPE = StreamLayouts.LANDSCAPE;
object2.duration_layout_landscape = roundBinding(_layoutBuckets[LANDSCAPE]);
const _layoutBuckets2 = this._layoutBuckets;
const MINIMIZED = StreamLayouts.MINIMIZED;
object2.duration_layout_minimized = roundBinding(_layoutBuckets2[MINIMIZED]);
if (this._isSender) {
object = {};
copyDataProperties(object, object2, _layoutBuckets);
object['target_fps'] = this._targetFPS;
object['target_resolution_height'] = this._targetResolution;
object['stream_settings_changed'] = this._streamSettingsChanged;
object['num_auto_quality_changes'] = this._automaticQualityChanges;
r0 = object;
} else {
r0 = object2;
}
return r0;
}
}
}
global.__d(_fun37427, 4404, [6, 7, 4399, 661, 4041, 4303,
2]) /* metro module 4404, dependencies: [6, 7, 4399, 661, 4041, 4303, 2] */;