Initial commit
This commit is contained in:
commit
af3b49f756
16065 files changed
+2938410
No files matched your search
@@ -0,0 +1,319 @@
|
||||
/* Metro module 12407; source: lib/VideoHealthManager.tsx; dependencies: [6, 7, 661, 3, 12408, 4303, 672, 4140, 2] */
|
||||
function _fun94656(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#94656, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:6, offset: 0x0212289e, size: 204 bytes, params: 8, frame: 19
|
||||
var object2;
|
||||
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 = (require(661) /* metro dependency 661: Constants */).VideoToggleState;
|
||||
const value = _fun94657();
|
||||
object2 = {'featureEnabled': null, 'windowLength': 5, 'allowedPoorFpsRatio': 1, 'fpsThreshold': 5,
|
||||
'backoffTimeSec': 15};
|
||||
object2.featureEnabled = (require(4140) /* metro dependency 4140: PlatformUtils */).isMobile;
|
||||
value.defaultConfig = object2;
|
||||
(require(2) /* metro dependency 2 */).fileFinishedImporting('lib/VideoHealthManager.tsx');
|
||||
exports.VideoHealthManager = value;
|
||||
}
|
||||
|
||||
function _fun94657() { // fn#94657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:145, offset: 0x0212296a, size: 346 bytes, params: 1, frame: 15
|
||||
return env0_4(VideoHealthManager, [{key: 'calculateFps', value: value_94659}, {key: 'updateFps',
|
||||
value: value_94660}, {key: 'startReenableBackoffTimer', value: value_94662}, {key: 'queueReenable',
|
||||
value: function(a0) {
|
||||
this.enableQueue.push(a0);
|
||||
this.tryReenableQueue();
|
||||
}}, {key: 'tryReenableQueue', value: function() {
|
||||
var property;
|
||||
var value;
|
||||
reducibleJoin7: while (true) {
|
||||
if (this.disabled) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
if (this.probingUserId != null) {
|
||||
if (this.probingUserId in this.perUserFpsWindow) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
}
|
||||
property = this.enableQueue;
|
||||
value = property.shift();
|
||||
if (value == null) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
if (this.reenableVideo(value)) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
reducibleLoop5: while (true) {
|
||||
if (value == null) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
if (this.reenableVideo(value)) {
|
||||
break reducibleJoin7;
|
||||
}
|
||||
continue reducibleLoop5;
|
||||
}
|
||||
}
|
||||
}}, {key: 'reenableVideo', value: value_94666}, {key: 'elapsedSeconds', value: function(a0, a1) {
|
||||
return (a0 - a1) / 1000;
|
||||
}}, {key: 'stateCleanupBeforeEnable', value: function(a0) {
|
||||
this.logger.info('VideoHealthManager::stateCleanupBeforeEnable');
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
this.prevFramesCodec[a0] = -1;
|
||||
this.streamDisabledUsers.delete(a0);
|
||||
}}, {key: 'getCurrentVideoToggleState', value: function(a0) {
|
||||
return this.currentVideoAutoToggleState[a0];
|
||||
}}, {key: 'createUser', value: value_94670}, {key: 'deleteUser', value: value_94671}, {key: 'disable',
|
||||
value: function() {
|
||||
var propertyName;
|
||||
this.disabled = true;
|
||||
for (propertyName in this.perUserFpsWindow) {
|
||||
this.deleteUser(propertyName);
|
||||
}
|
||||
}}]);
|
||||
}
|
||||
|
||||
function VideoHealthManager(a0, a1, a2, a3) { // fn#94658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:166, offset: 0x02122ac4, size: 330 bytes, params: 5, frame: 26
|
||||
let value = environment.__proto__;
|
||||
env1_3(this, VideoHealthManager);
|
||||
value = importDefault(3) /* metro dependency 3: Logger */;
|
||||
value = new value('VideoHealthManager');
|
||||
this.logger = value;
|
||||
this.disabled = false;
|
||||
this.perUserFpsWindow = {};
|
||||
this.prevFramesCodec = {};
|
||||
this.prevTimestamp = {};
|
||||
const Set = global.Set;
|
||||
this.streamDisabledUsers = new Set();
|
||||
this.retryBackoffCache = {};
|
||||
this.timeoutIdCache = {};
|
||||
this.currentVideoAutoToggleState = {};
|
||||
this.enableQueue = [];
|
||||
this.windowLength = a0;
|
||||
this.fpsThreshold = a2;
|
||||
const Math = global.Math;
|
||||
this.fpsWindowBorderlineCount = Math.ceil(a0 * a1);
|
||||
this.backoffTimeSec = a3;
|
||||
let logger = this.logger;
|
||||
logger.enableNativeLogger(true);
|
||||
logger = this.logger;
|
||||
logger.info('constructor with windowLength = ' + this.windowLength + ',\n fpsWindowBorderlineCount = ' + this.fpsWindowBorderlineCount + ',\n fpsThreshold = ' + this.fpsThreshold + ',\n backoffTimeSec = ' + a3);
|
||||
}
|
||||
|
||||
function value_94659(a0, a1, a2) { // fn#94659, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:889, offset: 0x02122c0e, size: 243 bytes, params: 4, frame: 16
|
||||
if (this.prevFramesCodec[a0] === -1) {
|
||||
this.prevFramesCodec[a0] = a1;
|
||||
this.prevTimestamp[a0] = a2;
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
return global.NaN;
|
||||
}
|
||||
if (a1 < this.prevFramesCodec[a0]) {
|
||||
this.prevFramesCodec[a0] = a1;
|
||||
this.prevTimestamp[a0] = a2;
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
return global.NaN;
|
||||
}
|
||||
if (a2 < this.prevTimestamp[a0]) {
|
||||
this.prevFramesCodec[a0] = a1;
|
||||
this.prevTimestamp[a0] = a2;
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
return global.NaN;
|
||||
}
|
||||
if (a2 > this.prevTimestamp[a0] + 1000 * this.windowLength) {
|
||||
this.prevFramesCodec[a0] = a1;
|
||||
this.prevTimestamp[a0] = a2;
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
return global.NaN;
|
||||
}
|
||||
if (a2 < this.prevTimestamp[a0] + 900) {
|
||||
return global.NaN;
|
||||
}
|
||||
let value = this.elapsedSeconds(a2, this.prevTimestamp[a0]);
|
||||
this.prevTimestamp[a0] = a2;
|
||||
value = (a1 - this.prevFramesCodec[a0]) / value;
|
||||
this.prevFramesCodec[a0] = a1;
|
||||
return value;
|
||||
}
|
||||
|
||||
function value_94660(a0, a1, a2) { // fn#94660, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:1338, offset: 0x02122d01, size: 538 bytes, params: 4, frame: 19
|
||||
var environment;
|
||||
var perUserFpsWindow;
|
||||
var property;
|
||||
var length;
|
||||
var windowLength;
|
||||
var currentVideoAutoToggleState;
|
||||
var AUTO_ENABLED;
|
||||
var DISABLED;
|
||||
if (!this.disabled) {
|
||||
var streamDisabledUsers = this.streamDisabledUsers;
|
||||
if (streamDisabledUsers.has(a0)) {
|
||||
return undefined;
|
||||
}
|
||||
var value = this.calculateFps(a0, a1, a2);
|
||||
if (value < 0) {
|
||||
return undefined;
|
||||
}
|
||||
var Number = global.Number;
|
||||
if (Number.isFinite(value)) {
|
||||
perUserFpsWindow = this.perUserFpsWindow;
|
||||
property = perUserFpsWindow[a0];
|
||||
property.push(value);
|
||||
perUserFpsWindow = this.perUserFpsWindow;
|
||||
length = perUserFpsWindow[a0].length;
|
||||
windowLength = this.windowLength;
|
||||
if (length < windowLength) {
|
||||
return undefined;
|
||||
}
|
||||
perUserFpsWindow = this.perUserFpsWindow;
|
||||
length = perUserFpsWindow[a0].length;
|
||||
windowLength = this.windowLength;
|
||||
if (length > windowLength) {
|
||||
this.perUserFpsWindow[a0].shift();
|
||||
}
|
||||
perUserFpsWindow = this.perUserFpsWindow;
|
||||
property = perUserFpsWindow[a0];
|
||||
length = property.filter(_fun94661).length;
|
||||
if (length >= this.fpsWindowBorderlineCount) {
|
||||
this.logger.info('' + a0 + ': detected poor network quality, turning off video');
|
||||
this.streamDisabledUsers.add(a0);
|
||||
currentVideoAutoToggleState = this.currentVideoAutoToggleState;
|
||||
value = environment.__proto__;
|
||||
DISABLED = VideoToggleState.DISABLED;
|
||||
currentVideoAutoToggleState[a0] = DISABLED;
|
||||
value = importDefault(12408) /* metro dependency 12408: dispatchAutoDisableVideo */;
|
||||
DISABLED = VideoToggleState.DISABLED;
|
||||
value(a0, DISABLED);
|
||||
this.startReenableBackoffTimer(a0);
|
||||
} else {
|
||||
currentVideoAutoToggleState = this.currentVideoAutoToggleState;
|
||||
property = currentVideoAutoToggleState[a0];
|
||||
value = environment.__proto__;
|
||||
if (property === VideoToggleState.AUTO_PROBING) {
|
||||
currentVideoAutoToggleState = this.currentVideoAutoToggleState;
|
||||
AUTO_ENABLED = VideoToggleState.AUTO_ENABLED;
|
||||
currentVideoAutoToggleState[a0] = AUTO_ENABLED;
|
||||
this.logger.info('acceptable conditions reached, will reset and send a AUTO_ENABLED for user ' + a0);
|
||||
value = importDefault(12408) /* metro dependency 12408: dispatchAutoDisableVideo */;
|
||||
AUTO_ENABLED = VideoToggleState.AUTO_ENABLED;
|
||||
value(a0, AUTO_ENABLED);
|
||||
}
|
||||
}
|
||||
if (this.probingUserId === a0) {
|
||||
this.probingUserId = undefined;
|
||||
this.tryReenableQueue();
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function value_94662(a0) { // fn#94662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:2309, offset: 0x02122f31, size: 361 bytes, params: 2, frame: 21
|
||||
var environment;
|
||||
var r7;
|
||||
var logger;
|
||||
var retryBackoffCache;
|
||||
var property;
|
||||
var lastBackoffTime;
|
||||
var expBackoffFactor;
|
||||
var value;
|
||||
var elapsedSeconds;
|
||||
var value2;
|
||||
var moduleValue;
|
||||
var object2;
|
||||
const env0_1 = a0;
|
||||
if (!this.disabled) {
|
||||
logger = this.logger;
|
||||
logger.info('startReenableBackoffTimer for user ' + a0);
|
||||
retryBackoffCache = this.retryBackoffCache;
|
||||
property = retryBackoffCache[a0];
|
||||
lastBackoffTime = property.lastBackoffTime;
|
||||
expBackoffFactor = property.expBackoffFactor;
|
||||
value = 1;
|
||||
if (lastBackoffTime === null) {
|
||||
r7 = value;
|
||||
} else if (expBackoffFactor > 16) {
|
||||
r7 = value;
|
||||
} else {
|
||||
elapsedSeconds = this.elapsedSeconds;
|
||||
value2 = environment.__proto__;
|
||||
moduleValue = require(4303) /* metro dependency 4303: TimeUtils */;
|
||||
r7 = Reflect.apply(elapsedSeconds, this, [moduleValue.now(),
|
||||
lastBackoffTime]) > 600 ? value : expBackoffFactor * 2;
|
||||
}
|
||||
retryBackoffCache = this.retryBackoffCache;
|
||||
object2 = {};
|
||||
value = environment.__proto__;
|
||||
object2.lastBackoffTime = (require(4303) /* metro dependency 4303: TimeUtils */).now();
|
||||
object2.expBackoffFactor = r7;
|
||||
retryBackoffCache[a0] = object2;
|
||||
value = r7 * this.backoffTimeSec * (importDefault(672) /* metro dependency 672: Durations */).Millis.SECOND;
|
||||
logger = this.logger;
|
||||
logger.info('starting backoff timer with time = ' + value + ' milliseconds');
|
||||
this.timeoutIdCache[a0] = global.setTimeout(_fun94663, value);
|
||||
}
|
||||
}
|
||||
|
||||
function value_94666(a0) { // fn#94666, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:3130, offset: 0x0212313c, size: 176 bytes, params: 2, frame: 22
|
||||
var r0;
|
||||
var logger;
|
||||
var info;
|
||||
var currentVideoAutoToggleState;
|
||||
var AUTO_PROBING;
|
||||
let value = a0 in this.perUserFpsWindow;
|
||||
if (value) {
|
||||
logger = this.logger;
|
||||
info = logger.info;
|
||||
value = environment.__proto__;
|
||||
Reflect.apply(info, logger,
|
||||
['reenableVideo called for user ' + a0 + ' - time = ' + (require(4303) /* metro dependency 4303: TimeUtils */).now()]);
|
||||
this.stateCleanupBeforeEnable(a0);
|
||||
currentVideoAutoToggleState = this.currentVideoAutoToggleState;
|
||||
AUTO_PROBING = VideoToggleState.AUTO_PROBING;
|
||||
currentVideoAutoToggleState[a0] = AUTO_PROBING;
|
||||
this.probingUserId = a0;
|
||||
value = importDefault(12408) /* metro dependency 12408: dispatchAutoDisableVideo */;
|
||||
AUTO_PROBING = VideoToggleState.AUTO_PROBING;
|
||||
value(a0, AUTO_PROBING);
|
||||
value = true;
|
||||
r0 = value;
|
||||
} else {
|
||||
r0 = value;
|
||||
}
|
||||
return r0;
|
||||
}
|
||||
|
||||
function value_94670(a0) { // fn#94670, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:3784, offset: 0x02123263, size: 141 bytes, params: 2, frame: 14
|
||||
var currentVideoAutoToggleState;
|
||||
var value;
|
||||
this.logger.info('VideoHealthManager::createUser ' + a0);
|
||||
if (!(a0 in this.perUserFpsWindow)) {
|
||||
this.perUserFpsWindow[a0] = [];
|
||||
this.prevFramesCodec[a0] = -1;
|
||||
currentVideoAutoToggleState = this.currentVideoAutoToggleState;
|
||||
value = environment.__proto__;
|
||||
currentVideoAutoToggleState[a0] = VideoToggleState.NONE;
|
||||
this.retryBackoffCache[a0] = {'lastBackoffTime': null, 'expBackoffFactor': 1};
|
||||
}
|
||||
}
|
||||
|
||||
function value_94671(a0) { // fn#94671, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:4074, offset: 0x021232f0, size: 166 bytes, params: 2, frame: 15
|
||||
this.logger.info('VideoHealthManager::deleteUser ' + a0);
|
||||
delete this.perUserFpsWindow[a0];
|
||||
delete this.prevFramesCodec[a0];
|
||||
delete this.retryBackoffCache[a0];
|
||||
delete this.currentVideoAutoToggleState[a0];
|
||||
this.streamDisabledUsers.delete(a0);
|
||||
if (a0 === this.probingUserId) {
|
||||
this.probingUserId = undefined;
|
||||
this.tryReenableQueue();
|
||||
}
|
||||
global.clearTimeout(this.timeoutIdCache[a0]);
|
||||
delete this.timeoutIdCache[a0];
|
||||
}
|
||||
|
||||
function _fun94661(a0) { // fn#94661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:1683, offset: 0x02122f1b, size: 22 bytes, params: 2, frame: 2
|
||||
return a0 < env0_0.fpsThreshold;
|
||||
}
|
||||
|
||||
function _fun94663() { // fn#94663, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12593:2774, offset: 0x0212309a, size: 28 bytes, params: 1, frame: 11
|
||||
env0_0.queueReenable(env0_1);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user