Files
discord-decomp/sources/modules/go_live/GoLiveQualityManager.tsx
T
2026-07-27 16:20:00 +03:00

176 lines
7.3 KiB
TypeScript

/* Metro module 12391; source: modules/go_live/GoLiveQualityManager.tsx; dependencies: [6, 7, 15, 17, 18, 3, 4041, 4479, 2] */
function _fun94411(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94411, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:6, offset: 0x02117121, size: 246 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
let value = importDefault(4479) /* metro dependency 4479: TypedEventEmitter */;
value = _fun94415(value);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/go_live/GoLiveQualityManager.tsx');
exports.default = value;
exports.GoLiveQualityManagerEvent = {RequestedSSRCsUpdate: 'requested-ssrcs-update',
RequestedStreamsUpdate: 'requested-streams-update'};
}
function _isNativeReflectConstruct_94412() { // fn#94412, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:148, offset: 0x02117217, 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_94412_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun94415(a0) { // fn#94415, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:475, offset: 0x02117279, size: 307 bytes, params: 2, frame: 16
const closure = GoLiveQualityManager;
env0_7(closure, a0);
return env0_4(closure, [{key: 'setUserID', value: function(a0) {
this.userId = a0;
}}, {key: 'getUserID', value: function() {
return this.userId;
}}, {key: 'updateAudioAndVideoStreamInfo', value: function(a0, a1) {
this.audioSSRC = a0;
this.videoStream = a1.find(_fun94422);
this.update();
}}, {key: 'onIncomingVideoEnabled', value: function(a0) {
if (this.incomingVideoEnabled !== a0) {
this.logger.info('onIncomingVideoEnabled', a0);
this.incomingVideoEnabled = a0;
this.update();
}
}}, {key: 'update', value: function() {
if (this.userId != null && this.videoStream != null) {
if (this.incomingVideoEnabled) {
this.requestStream();
} else {
this.stopStream();
}
}
}}, {key: 'requestStream', value: function() {
if (this.videoStream != null) {
this.request({[this.videoStream.ssrc]: 100}, [this.videoStream.ssrc]);
}
}}, {key: 'stopStream', value: function() {
if (this.videoStream != null) {
this.request({[this.videoStream.ssrc]: 0}, []);
}
}}, {key: 'request', value: value_94427}, {key: 'setVideoSize', value: function(a0, a1, a2) {
if (this.streamId === a0) {
if (a1 != null) {
this.resolutionWidth = a1.width;
this.resolutionHeight = a1.height;
}
if (a2 != null) {
this.zoom = a2;
}
this.delayedUpdate();
}
}}, {key: 'setStreamId', value: function(a0) {
if (this.streamId !== a0) {
this.streamId = a0;
this.resolutionWidth = 0;
this.resolutionHeight = 0;
this.zoom = 1;
this.delayedUpdate();
}
}}]);
}
function GoLiveQualityManager() { // fn#94416, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:487, offset: 0x021173ac, size: 302 bytes, params: 1, frame: 21
var environment;
const value = environment.__proto__;
env1_3(this, GoLiveQualityManager);
const value3 = env1_6(GoLiveQualityManager);
const value6 = env1_5(this, _isNativeReflectConstruct_94412() ? global.Reflect.construct(value3, [],
env1_6(this).constructor) : value3.apply(this, undefined));
value6.streamId = null;
value6.resolutionWidth = 0;
value6.resolutionHeight = 0;
value6.zoom = 1;
value6.audioSSRC = 0;
value6.incomingVideoEnabled = true;
value6.delayedUpdate = delayedUpdate;
const defaultImport = importDefault(3) /* metro dependency 3: Logger */;
const value7 = Object.create(defaultImport.prototype, {constructor: {value: defaultImport}});
const defaultImport2 = new defaultImport('GoLiveQualityManager');
value6.logger = defaultImport2 instanceof Object ? defaultImport2 : value7;
value6.logger.enableNativeLogger(true);
const DelayedCall = (require(4041) /* metro dependency 4041: Timers */).DelayedCall;
value6.delayedCall = new DelayedCall(500, _fun94418);
return value6;
}
function value_94421(a0, a1) { // fn#94421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:1221, offset: 0x021174f4, size: 55 bytes, params: 3, frame: 12
this.audioSSRC = a0;
this.videoStream = a1.find(function(a0) {
return a0.active;
});
this.update();
}
function value_94427(a0, a1) { // fn#94427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:1887, offset: 0x0211762b, size: 107 bytes, params: 3, frame: 20
var environment;
var emit;
var value;
var binding;
const userId = this.userId;
if (userId !== undefined) {
var env0_1 = a0;
a1.forEach(_fun94428);
emit = this.emit;
value = environment.__proto__;
binding = env1_8;
Reflect.apply(emit, this, [binding.RequestedSSRCsUpdate, this.userId, this.audioSSRC, a1]);
this.emit(binding.RequestedStreamsUpdate, a0);
}
}
function _fun94428(a0) { // fn#94428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12577:1945, offset: 0x02117696, size: 125 bytes, params: 2, frame: 15
var binding;
var Math;
var floor;
var zoom;
var value;
let pixelCounts = env0_1.pixelCounts;
if (pixelCounts == null) {
env0_1.pixelCounts = {};
}
if (env0_1[a0] > 0) {
pixelCounts = env0_1.pixelCounts;
Math = global.Math;
floor = Math.floor;
binding = env0_0;
value = binding.resolutionWidth * binding.resolutionHeight;
zoom = binding.zoom;
value *= zoom;
zoom = binding.zoom;
pixelCounts[a0] = Reflect.apply(floor, Math, [value * zoom]);
}
}