Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
85 lines
3.9 KiB
TypeScript
85 lines
3.9 KiB
TypeScript
// Module ID: 17886
|
|
// Function ID: 17887
|
|
// Name: RTCLatencyTestManager
|
|
// Dependencies: [1992, 4838, 4813, 1091, 3, 7395, 17887, 1364, 2]
|
|
|
|
// Module 17886 (RTCLatencyTestManager)
|
|
import LoggerDefault from "Logger" /* 3 */;
|
|
import DurationsDefault from "Durations" /* 1091 */;
|
|
import PlatformUtils from "PlatformUtils" /* 1364 */;
|
|
import RTCLatencyTestActionCreators from "RTCLatencyTestActionCreators" /* 17887 */;
|
|
import MediaEngineStore from "MediaEngineStore" /* 1992 */;
|
|
import RTCRegionStore from "RTCRegionStore" /* 4838 */;
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7395 */;
|
|
|
|
require = fn;
|
|
const Features = fn(4813).Features;
|
|
const SECOND = DurationsDefault.Millis.SECOND;
|
|
let closure_7 = 30 * DurationsDefault.Millis.SECOND;
|
|
let obj = new LoggerDefault("RTCLatencyTestManager");
|
|
obj.enableNativeLogger(true);
|
|
class RTCLatencyTestManager extends tmp3 {
|
|
constructor() {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
closure_0 = applyArgumentsResult;
|
|
applyArgumentsResult.actions = {
|
|
POST_CONNECTION_OPEN() {
|
|
return applyArgumentsResult._handleConnectionOpen();
|
|
}
|
|
};
|
|
applyArgumentsResult._handleTestRegionsResponse = function _handleTestRegionsResponse(body) {
|
|
const mapped = body.map((region) => region.region);
|
|
if (closure_4.shouldPerformLatencyTest(mapped)) {
|
|
mediaEngine = mediaEngine.getMediaEngine();
|
|
const rankRtcRegionsResult = mediaEngine.rankRtcRegions(body);
|
|
mediaEngine.rankRtcRegions(body).then((result) => {
|
|
obj.verbose("RTC region latency test completed, ranked regions are: ", result);
|
|
result = applyArgumentsResult(dependencyMap[6]).completeRTCLatencyTest(result, mapped);
|
|
}).catch((error) => logger.warn(error));
|
|
const nextPromise = mediaEngine.rankRtcRegions(body).then((result) => {
|
|
obj.verbose("RTC region latency test completed, ranked regions are: ", result);
|
|
result = applyArgumentsResult(dependencyMap[6]).completeRTCLatencyTest(result, mapped);
|
|
});
|
|
} else {
|
|
const _HermesInternal = HermesInternal;
|
|
logger.verbose("RTC cached ranked preferred regions are " + closure_4.getPreferredRegions());
|
|
}
|
|
};
|
|
applyArgumentsResult._fetchAndScheduleRefetch = function _fetchAndScheduleRefetch() {
|
|
let num = 1;
|
|
if (MediaEngineStore.supports(Features.PORT_AWARE_LATENCY_TESTING)) {
|
|
num = 2;
|
|
}
|
|
const rTCLatencyTestRegions = RTCLatencyTestActionCreators.fetchRTCLatencyTestRegions(num);
|
|
rTCLatencyTestRegions.then((body) => closure_1_0._handleTestRegionsResponse(body.body)).catch((error) => logger.warn(error));
|
|
applyArgumentsResult.refetchTimeout = setTimeout(applyArgumentsResult._fetchAndScheduleRefetch, 360 * DurationsDefault.Millis.MINUTE);
|
|
};
|
|
applyArgumentsResult._handleConnectionOpen = function _handleConnectionOpen() {
|
|
if (null != window.GLOBAL_ENV.RTC_LATENCY_ENDPOINT) {
|
|
if (PlatformUtils.isPlatformEmbedded) {
|
|
const _Math = Math;
|
|
const _Math2 = Math;
|
|
const rounded = Math.floor(SECOND + Math.random() * closure_7);
|
|
if (null != applyArgumentsResult.refetchTimeout) {
|
|
const _clearTimeout = clearTimeout;
|
|
clearTimeout(tmp4.refetchTimeout);
|
|
}
|
|
const _setTimeout = setTimeout;
|
|
applyArgumentsResult.refetchTimeout = setTimeout(applyArgumentsResult._fetchAndScheduleRefetch, rounded);
|
|
}
|
|
}
|
|
};
|
|
return applyArgumentsResult;
|
|
}
|
|
}
|
|
RTCLatencyTestManager.prototype["_terminate"] = function _terminate() {
|
|
if (null != this.refetchTimeout) {
|
|
const _clearTimeout = clearTimeout;
|
|
clearTimeout(tmp.refetchTimeout);
|
|
}
|
|
};
|
|
const rTCLatencyTestManager = new RTCLatencyTestManager();
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("modules/rtc/RTCLatencyTestManager.tsx");
|
|
|
|
export default rTCLatencyTestManager;
|