1333 lines
51 KiB
JavaScript
1333 lines
51 KiB
JavaScript
// Metro module 4287 (f4288).
|
|
import _slicedToArray from "./_slicedToArray";
|
|
import { QUEUE_METRICS_INTERVAL_MS, ProcessPriority, SIDECHAIN_COMPRESSION_MIN_THRESHOLD, SIDECHAIN_COMPRESSION_MAX_THRESHOLD, SIDECHAIN_COMPRESSION_MIN_RATIO, SIDECHAIN_COMPRESSION_MAX_RATIO } from "./Module4250";
|
|
import { DISABLED_DEVICE_ID, DeviceTypes, DEFAULT_VOLUME, AudioSubsystems, Features, NativeFeatures, MediaEngineContextTypes, ClipsRecordingEvent, WATCHDOG_TIMEOUT_MS } from "./Module4288";
|
|
import TypedEventEmitter from "./TypedEventEmitter";
|
|
import Video from "./Video";
|
|
import Camera from "./Camera";
|
|
import { Logger } from "./log";
|
|
import * as _Module4238 from "./Module4238";
|
|
import { getVoiceEngine, supportsFeature, setProcessPriority } from "./Module4238";
|
|
import { MediaEngineEvent, BaseConnectionEvent } from "./Module4286";
|
|
import pollConnectionStats from "./pollConnectionStats";
|
|
import Module669 from "./Module669";
|
|
import Module4296 from "./Module4296";
|
|
import * as _Module4356 from "./Module4356";
|
|
import { sanitizeDevices } from "./Module4356";
|
|
function $mk114498($env) {
|
|
return (a0) => a0.id === $env[0];
|
|
}
|
|
function $mk114499($env) {
|
|
return (a0) => a0.setVideoBroadcast($env[1].shouldConnectionBroadcastVideo(a0));
|
|
}
|
|
let c2524_20;
|
|
let env2524 = {};
|
|
class MediaEngineNative extends TypedEventEmitter {
|
|
constructor() {
|
|
super();
|
|
const _this = this;
|
|
let c14086_0 = this;
|
|
this.Video = Video;
|
|
this.Camera = Camera;
|
|
this.audioInputDeviceId = DISABLED_DEVICE_ID;
|
|
this.audioOutputDeviceId = DISABLED_DEVICE_ID;
|
|
this.videoInputDeviceId = DISABLED_DEVICE_ID;
|
|
this.connections = new Set();
|
|
this.lastVoiceActivity = -1;
|
|
this.audioSubsystem = "standard";
|
|
this.audioLayer = "";
|
|
this.deviceChangeGeneration = 0;
|
|
this.consecutiveWatchdogFailures = 0;
|
|
this.codecSurvey = null;
|
|
this.clipsRecordingEventContext = {
|
|
id: "",
|
|
soundshareId: 0,
|
|
applicationName: ""
|
|
};
|
|
this.clipsRecordingEventHandlerRegistered = false;
|
|
this.logger = new Logger("MediaEngineNative");
|
|
this.handleDeviceChange = function handleDeviceChange(r11 = [], r12 = [], r9 = []) {
|
|
c14086_0.deviceChangeGeneration = c14086_0.deviceChangeGeneration + 1;
|
|
c14086_0.emit(MediaEngineEvent.DeviceChange, sanitizeDevices(DeviceTypes.AUDIO_INPUT, r11), sanitizeDevices(DeviceTypes.AUDIO_OUTPUT, r12), sanitizeDevices(DeviceTypes.VIDEO_INPUT, r9));
|
|
};
|
|
this.handleVolumeChange = (a0, a1) => {
|
|
c14086_0.emit(MediaEngineEvent.VolumeChange, a0 * DEFAULT_VOLUME, a1 * DEFAULT_VOLUME);
|
|
};
|
|
this.handleVoiceActivity = (a0, a1) => {
|
|
const lastVoiceActivity = Date.now();
|
|
if (c14086_0.listenerCount(MediaEngineEvent.VoiceActivity) > 0 && (c14086_0.lastVoiceActivity === -1 || Date.now() - c14086_0.lastVoiceActivity > 20)) {
|
|
c14086_0.lastVoiceActivity = lastVoiceActivity;
|
|
c14086_0.emit(MediaEngineEvent.VoiceActivity, a0, a1);
|
|
}
|
|
};
|
|
this.handleActiveSinksChange = (c25022_0, c25022_1) => {
|
|
c14086_0.connections.forEach((connection) => connection.setHasActiveVideoOutputSink(c25022_0, c25022_1, "MediaEngineNative.handleActiveSinksChange"));
|
|
};
|
|
this.handleNewListener = (a0) => {
|
|
if (MediaEngineEvent.VoiceActivity === a0) {
|
|
if (getVoiceEngine().setEmitVADLevel2 != null) {
|
|
getVoiceEngine().setEmitVADLevel2(true);
|
|
} else {
|
|
getVoiceEngine().setEmitVADLevel(true, false, {});
|
|
}
|
|
} else if (MediaEngineEvent.DeviceChange === a0) {
|
|
const deviceChangeGeneration = c14086_0.deviceChangeGeneration;
|
|
Promise.all([c14086_0.getAudioInputDevices(), c14086_0.getAudioOutputDevices(), c14086_0.getVideoInputDevices()]).then((result) => {
|
|
const [r8, r7, r31] = result;
|
|
if (deviceChangeGeneration === c14086_0.deviceChangeGeneration) {
|
|
c14086_0.emit(MediaEngineEvent.DeviceChange, r8, r7, r31);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
this.handleRemoveListener = (a0) => {
|
|
if (a0 === MediaEngineEvent.VoiceActivity) {
|
|
if (getVoiceEngine().setEmitVADLevel2 != null) {
|
|
getVoiceEngine().setEmitVADLevel2(c14086_0.listenerCount(MediaEngineEvent.VoiceActivity) > 0);
|
|
} else {
|
|
getVoiceEngine().setEmitVADLevel(c14086_0.listenerCount(MediaEngineEvent.VoiceActivity) > 0, false, {});
|
|
}
|
|
}
|
|
};
|
|
this.handleVideoInputInitialization = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.VideoInputInitialized, a0);
|
|
};
|
|
this.handleAudioInputInitialization = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.AudioInputInitialized, a0);
|
|
};
|
|
this.handleNativeScreenSharePickerUpdate = (a0, a1) => {
|
|
c14086_0.emit(MediaEngineEvent.NativeScreenSharePickerUpdate, a0, a1);
|
|
};
|
|
this.handleNativeScreenSharePickerCancel = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.NativeScreenSharePickerCancel, a0);
|
|
};
|
|
this.handleNativeScreenSharePickerError = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.NativeScreenSharePickerError, a0);
|
|
};
|
|
this.handleAudioDeviceModuleErrorCallback = (a0, a1) => {
|
|
if (a0 !== -100) {
|
|
c14086_0.emit(MediaEngineEvent.AudioDeviceModuleError, "RustAudioDeviceModule", a0, a1);
|
|
}
|
|
};
|
|
this.handleVideoCodecErrorCallback = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.VideoCodecError, a0);
|
|
};
|
|
this.handleVoiceProcessingErrorCallback = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.VoiceProcessingError, a0);
|
|
};
|
|
this.handleVideoFilterErrorCallback = (a0, a1) => {
|
|
c14086_0.emit(MediaEngineEvent.VideoFilterError, a0, a1);
|
|
};
|
|
this.handleSystemMicrophoneModeChangeCallback = (a0) => {
|
|
c14086_0.emit(MediaEngineEvent.SystemMicrophoneModeChange, a0);
|
|
};
|
|
this.logger.enableNativeLogger(true);
|
|
const voiceEngine5 = getVoiceEngine();
|
|
voiceEngine5.setDeviceChangeCallback(this.handleDeviceChange);
|
|
voiceEngine5.setVolumeChangeCallback(this.handleVolumeChange);
|
|
voiceEngine5.setOnVoiceCallback(this.handleVoiceActivity);
|
|
const setVideoInputInitializationCallback = voiceEngine5.setVideoInputInitializationCallback;
|
|
if (setVideoInputInitializationCallback != null) {
|
|
setVideoInputInitializationCallback.call(voiceEngine5, this.handleVideoInputInitialization);
|
|
}
|
|
const setAudioInputInitializationCallback = voiceEngine5.setAudioInputInitializationCallback;
|
|
if (setAudioInputInitializationCallback != null) {
|
|
setAudioInputInitializationCallback.call(voiceEngine5, this.handleAudioInputInitialization);
|
|
}
|
|
const setAudioDeviceModuleErrorCallback = voiceEngine5.setAudioDeviceModuleErrorCallback;
|
|
if (setAudioDeviceModuleErrorCallback != null) {
|
|
setAudioDeviceModuleErrorCallback.call(voiceEngine5, this.handleAudioDeviceModuleErrorCallback);
|
|
}
|
|
voiceEngine5.setTransportOptions({
|
|
idleJitterBufferFlush: true,
|
|
ducking: false
|
|
});
|
|
const setNativeScreenSharePickerCallbacks = voiceEngine5.setNativeScreenSharePickerCallbacks;
|
|
if (setNativeScreenSharePickerCallbacks != null) {
|
|
setNativeScreenSharePickerCallbacks.call(voiceEngine5, this.handleNativeScreenSharePickerUpdate, this.handleNativeScreenSharePickerCancel, this.handleNativeScreenSharePickerError);
|
|
}
|
|
const setVideoCodecErrorCallback = voiceEngine5.setVideoCodecErrorCallback;
|
|
if (setVideoCodecErrorCallback != null) {
|
|
setVideoCodecErrorCallback.call(voiceEngine5, this.handleVideoCodecErrorCallback);
|
|
}
|
|
const setVoiceProcessingErrorCallback = voiceEngine5.setVoiceProcessingErrorCallback;
|
|
if (setVoiceProcessingErrorCallback != null) {
|
|
setVoiceProcessingErrorCallback.call(voiceEngine5, this.handleVoiceProcessingErrorCallback);
|
|
}
|
|
const setVideoFilterErrorCallback = voiceEngine5.setVideoFilterErrorCallback;
|
|
if (setVideoFilterErrorCallback != null) {
|
|
setVideoFilterErrorCallback.call(voiceEngine5, this.handleVideoFilterErrorCallback);
|
|
}
|
|
const setSystemMicrophoneModeChangeCallback = voiceEngine5.setSystemMicrophoneModeChangeCallback;
|
|
if (setSystemMicrophoneModeChangeCallback != null) {
|
|
setSystemMicrophoneModeChangeCallback.call(voiceEngine5, this.handleSystemMicrophoneModeChangeCallback);
|
|
}
|
|
this.on("removeListener", this.handleRemoveListener);
|
|
this.on("newListener", this.handleNewListener);
|
|
if (getVoiceEngine().getAudioSubsystem != null) {
|
|
getVoiceEngine().getAudioSubsystem((a0, a1) => {
|
|
_this.audioSubsystem = a0;
|
|
_this.audioLayer = a1;
|
|
});
|
|
} else if (getVoiceEngine().getUseLegacyAudioDevice != null) {
|
|
this.audioSubsystem = getVoiceEngine().getUseLegacyAudioDevice() ? AudioSubsystems.LEGACY : AudioSubsystems.STANDARD;
|
|
}
|
|
if (voiceEngine5.pingVoiceThread != null) {
|
|
this.watchdogTick();
|
|
}
|
|
if (voiceEngine5.setActiveSinksChangeCallback != null) {
|
|
voiceEngine5.setActiveSinksChangeCallback(this.handleActiveSinksChange);
|
|
}
|
|
const setOnClipsMlDetection = voiceEngine5.setOnClipsMlDetection;
|
|
if (setOnClipsMlDetection != null) {
|
|
setOnClipsMlDetection.call(voiceEngine5, (a0) => {
|
|
if (a0.length > 0) {
|
|
_this.emit(MediaEngineEvent.ClipsMlDetection, a0);
|
|
}
|
|
});
|
|
}
|
|
let c14087_1, _pollMetrics2;
|
|
pollConnectionStats(this);
|
|
let c14087_0 = this;
|
|
const pollMetrics2 = function pollMetrics() {
|
|
return _pollMetrics2.apply(this, arguments);
|
|
};
|
|
_pollMetrics2 = function _pollMetrics() {
|
|
const r9 = async () => {
|
|
let c31340_0, c31340_1;
|
|
L13: {
|
|
let env31927;
|
|
c31340_1 = void 0;
|
|
const r26 = env31927 = {};
|
|
c31340_0 = r26;
|
|
env31927[0] = void 0;
|
|
env31927[1] = void 0;
|
|
if (c14087_1) {
|
|
break L13;
|
|
}
|
|
env31927[0] = getVoiceEngine();
|
|
env31927[1] = await new Promise((c32115_0) => {
|
|
const r3 = env31927[0];
|
|
const pollQueueMetrics = r3.pollQueueMetrics;
|
|
if (pollQueueMetrics != null) {
|
|
pollQueueMetrics.call(r3, (a0) => {
|
|
c32115_0(a0);
|
|
});
|
|
}
|
|
});
|
|
env31927[1].periodMs = QUEUE_METRICS_INTERVAL_MS;
|
|
c14087_0.emit(MediaEngineEvent.VoiceQueueMetrics, env31927[1]);
|
|
setTimeout(pollMetrics2, QUEUE_METRICS_INTERVAL_MS);
|
|
return void 0;
|
|
}
|
|
};
|
|
_pollMetrics2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
c14087_1 = false;
|
|
this.on(MediaEngineEvent.Destroy, () => {
|
|
c14087_1 = true;
|
|
return true;
|
|
});
|
|
setTimeout(pollMetrics2, QUEUE_METRICS_INTERVAL_MS);
|
|
}
|
|
destroy() {
|
|
this.eachConnection((a0) => a0.destroy());
|
|
this.emit(MediaEngineEvent.Destroy);
|
|
this.removeAllListeners();
|
|
}
|
|
interact() {}
|
|
static supported() {
|
|
return _Module4238.supported();
|
|
}
|
|
supported() {
|
|
return true;
|
|
}
|
|
supports(a0) {
|
|
if (Features.LEGACY_AUDIO_SUBSYSTEM === a0) {
|
|
return supportsFeature(NativeFeatures.VOICE_LEGACY_SUBSYSTEM);
|
|
}
|
|
if (Features.EXPERIMENTAL_AUDIO_SUBSYSTEM === a0) {
|
|
return supportsFeature(NativeFeatures.VOICE_EXPERIMENTAL_SUBSYSTEM);
|
|
}
|
|
if (Features.AUTOMATIC_AUDIO_SUBSYSTEM === a0) {
|
|
return supportsFeature(NativeFeatures.VOICE_AUTOMATIC_SUBSYSTEM);
|
|
}
|
|
if (Features.AUDIO_SUBSYSTEM_DEFERRED_SWITCH === a0) {
|
|
return supportsFeature(NativeFeatures.VOICE_SUBSYSTEM_DEFERRED_SWITCH);
|
|
}
|
|
if (Features.AUDIO_BYPASS_SYSTEM_INPUT_PROCESSING === a0) {
|
|
return supportsFeature(NativeFeatures.VOICE_BYPASS_SYSTEM_AUDIO_INPUT_PROCESSING);
|
|
}
|
|
if (Features.DEBUG_LOGGING === a0) {
|
|
return supportsFeature(NativeFeatures.DEBUG_LOGGING);
|
|
}
|
|
if (Features.SOUNDSHARE === a0) {
|
|
return supportsFeature(NativeFeatures.SOUNDSHARE);
|
|
}
|
|
if (Features.SCREEN_SOUNDSHARE === a0) {
|
|
return supportsFeature(NativeFeatures.SCREEN_SOUNDSHARE);
|
|
}
|
|
if (Features.ELEVATED_HOOK === a0) {
|
|
return supportsFeature(NativeFeatures.ELEVATED_HOOK);
|
|
}
|
|
if (Features.LOOPBACK === a0) {
|
|
return supportsFeature(NativeFeatures.LOOPBACK);
|
|
}
|
|
if (Features.WUMPUS_VIDEO === a0) {
|
|
return supportsFeature(NativeFeatures.WUMPUS_VIDEO);
|
|
}
|
|
if (Features.HYBRID_VIDEO === a0) {
|
|
return supportsFeature(NativeFeatures.HYBRID_VIDEO);
|
|
}
|
|
if (Features.ATTENUATION !== a0 && Features.VIDEO_HOOK !== a0) {
|
|
if (Features.EXPERIMENTAL_SOUNDSHARE === a0) {
|
|
return supportsFeature(NativeFeatures.SOUNDSHARE_LOOPBACK);
|
|
}
|
|
if (Features.REMOTE_LOCUS_NETWORK_CONTROL === a0) {
|
|
return supportsFeature(NativeFeatures.REMOTE_LOCUS_NETWORK_CONTROL);
|
|
}
|
|
if (Features.SCREEN_PREVIEWS === a0) {
|
|
return supportsFeature(NativeFeatures.SCREEN_PREVIEWS);
|
|
}
|
|
if (Features.CLIPS === a0) {
|
|
return supportsFeature(NativeFeatures.CLIPS);
|
|
}
|
|
if (Features.CLIPS_RECORDING_READY_EVENTS === a0) {
|
|
return supportsFeature(NativeFeatures.CLIPS_RECORDING_READY_EVENTS);
|
|
}
|
|
if (Features.WINDOW_PREVIEWS === a0) {
|
|
return supportsFeature(NativeFeatures.WINDOW_PREVIEWS);
|
|
}
|
|
if (Features.AUDIO_DEBUG_STATE === a0) {
|
|
return supportsFeature(NativeFeatures.AUDIO_DEBUG_STATE);
|
|
}
|
|
if (Features.CONNECTION_REPLAY === a0) {
|
|
return supportsFeature(NativeFeatures.CONNECTION_REPLAY);
|
|
}
|
|
if (Features.SIMULCAST === a0) {
|
|
return supportsFeature(NativeFeatures.SIMULCAST) && supportsFeature(NativeFeatures.SIMULCAST_BUGFIX);
|
|
}
|
|
if (Features.RTC_REGION_RANKING === a0) {
|
|
return supportsFeature(NativeFeatures.RTC_REGION_RANKING);
|
|
}
|
|
if (Features.ELECTRON_VIDEO === a0) {
|
|
return supportsFeature(NativeFeatures.ELECTRON_VIDEO);
|
|
}
|
|
if (Features.MEDIAPIPE === a0) {
|
|
return supportsFeature(NativeFeatures.MEDIAPIPE);
|
|
}
|
|
if (Features.FIXED_KEYFRAME_INTERVAL === a0) {
|
|
return supportsFeature(NativeFeatures.FIXED_KEYFRAME_INTERVAL);
|
|
}
|
|
if (Features.FIRST_FRAME_CALLBACK === a0) {
|
|
return supportsFeature(NativeFeatures.FIRST_FRAME_CALLBACK);
|
|
}
|
|
if (Features.REMOTE_USER_MULTI_STREAM === a0) {
|
|
return supportsFeature(NativeFeatures.REMOTE_USER_MULTI_STREAM);
|
|
}
|
|
if (Features.IMAGE_QUALITY_MEASUREMENT === a0) {
|
|
return supportsFeature(NativeFeatures.IMAGE_QUALITY_MEASUREMENT);
|
|
}
|
|
if (Features.GO_LIVE_HARDWARE === a0) {
|
|
return supportsFeature(NativeFeatures.GO_LIVE_HARDWARE);
|
|
}
|
|
if (Features.SCREEN_CAPTURE_KIT === a0) {
|
|
return supportsFeature(NativeFeatures.SCREEN_CAPTURE_KIT);
|
|
}
|
|
if (Features.NATIVE_SCREENSHARE_PICKER === a0) {
|
|
return supportsFeature(NativeFeatures.NATIVE_SCREENSHARE_PICKER);
|
|
}
|
|
if (Features.MLS_PAIRWISE_FINGERPRINTS === a0) {
|
|
return supportsFeature(NativeFeatures.MLS_PAIRWISE_FINGERPRINTS);
|
|
}
|
|
if (Features.OFFLOAD_ADM_CONTROLS === a0) {
|
|
return supportsFeature(NativeFeatures.OFFLOAD_ADM_CONTROLS);
|
|
}
|
|
if (Features.VAAPI === a0) {
|
|
return supportsFeature(NativeFeatures.VAAPI);
|
|
}
|
|
if (Features.GAMESCOPE_CAPTURE === a0) {
|
|
return supportsFeature(NativeFeatures.GAMESCOPE_CAPTURE);
|
|
}
|
|
if (Features.ASYNC_VIDEO_INPUT_DEVICE_INIT === a0) {
|
|
return supportsFeature(NativeFeatures.ASYNC_VIDEO_INPUT_DEVICE_INIT);
|
|
}
|
|
if (Features.PORT_AWARE_LATENCY_TESTING === a0) {
|
|
return supportsFeature(NativeFeatures.PORT_AWARE_LATENCY_TESTING);
|
|
}
|
|
if (Features.SPATIAL_AUDIO === a0) {
|
|
return supportsFeature(NativeFeatures.SPATIAL_AUDIO);
|
|
}
|
|
if (Features.KRISP_NATIVE_ERROR === a0) {
|
|
return supportsFeature(NativeFeatures.KRISP_NATIVE_ERROR);
|
|
}
|
|
if (Features.DIAGNOSTICS !== a0 && Features.NATIVE_PING !== a0 && Features.AUTOMATIC_VAD !== a0 && Features.AUDIO_INPUT_DEVICE !== a0 && Features.AUDIO_OUTPUT_DEVICE !== a0 && Features.QOS !== a0 && Features.VOICE_PROCESSING !== a0 && Features.AUTO_ENABLE !== a0 && Features.VIDEO !== a0 && Features.DESKTOP_CAPTURE !== a0 && Features.DESKTOP_CAPTURE_FORMAT !== a0 && Features.DESKTOP_CAPTURE_APPLICATIONS !== a0 && Features.VOICE_PANNING !== a0 && Features.AEC_DUMP !== a0 && Features.DISABLE_VIDEO !== a0 && Features.SAMPLE_PLAYBACK !== a0 && Features.NOISE_SUPPRESSION !== a0 && Features.AUTOMATIC_GAIN_CONTROL !== a0 && Features.SIDECHAIN_COMPRESSION !== a0) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
return (Module669 == null ? void 0 : Module669.os?.family) != null && /^win/i.test(Module669.os.family);
|
|
}
|
|
connect(a0, a1, a2) {
|
|
if (!supportsFeature(NativeFeatures.EXPERIMENT_CONFIG)) {
|
|
a2.experiments = void 0;
|
|
}
|
|
const r20 = Module4296.create(a0, a1, a2);
|
|
let c14088_0 = r20;
|
|
r20.on(BaseConnectionEvent.Destroy, (a0) => {
|
|
this.connections.delete(a0);
|
|
if (this.connectionsEmpty()) {
|
|
setProcessPriority(ProcessPriority.NORMAL);
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setNativeThreadsPriority = voiceEngine5.setNativeThreadsPriority;
|
|
if (setNativeThreadsPriority != null) {
|
|
setNativeThreadsPriority.call(voiceEngine5, 0);
|
|
}
|
|
}
|
|
});
|
|
r20.on(BaseConnectionEvent.Connected, () => {
|
|
c14088_0.setVideoBroadcast(this.shouldConnectionBroadcastVideo(c14088_0));
|
|
});
|
|
r20.on(BaseConnectionEvent.Silence, (a0) => {
|
|
this.emit(MediaEngineEvent.Silence, a0);
|
|
});
|
|
this.connections.add(r20);
|
|
let processPriority = a2.processPriority;
|
|
if (processPriority == null) {
|
|
processPriority = ProcessPriority.HIGH;
|
|
}
|
|
setProcessPriority(processPriority);
|
|
if (a2.threadPriorityConfiguration != null) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setNativeThreadsPriority = voiceEngine5.setNativeThreadsPriority;
|
|
if (setNativeThreadsPriority != null) {
|
|
setNativeThreadsPriority.call(voiceEngine5, a2.threadPriorityConfiguration);
|
|
}
|
|
}
|
|
this.emit(MediaEngineEvent.Connection, r20);
|
|
return r20;
|
|
}
|
|
shouldConnectionBroadcastVideo(a0) {
|
|
return a0.context === MediaEngineContextTypes.DEFAULT && this.videoInputDeviceId !== DISABLED_DEVICE_ID || a0.hasDesktopSource();
|
|
}
|
|
eachConnection(c14089_0, c14089_1) {
|
|
this.connections.forEach((connection) => {
|
|
if (!(c14089_1 != null && connection.context !== c14089_1)) {
|
|
c14089_0(connection);
|
|
}
|
|
});
|
|
}
|
|
enable() {
|
|
return Promise.resolve();
|
|
}
|
|
setAudioMixerOptions(a0) {
|
|
if (supportsFeature(NativeFeatures.SPATIAL_AUDIO)) {
|
|
getVoiceEngine().setTransportOptions({
|
|
audioMixerOptions: a0
|
|
});
|
|
}
|
|
}
|
|
setAudioInputBypassSystemProcessing(a0) {
|
|
getVoiceEngine().setTransportOptions({
|
|
bypassSystemProcessing: a0
|
|
});
|
|
}
|
|
setInputVolume(a0) {
|
|
let r5 = a0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (a0 == null) {
|
|
r5 = DEFAULT_VOLUME;
|
|
}
|
|
voiceEngine5.setInputVolume(r5 / DEFAULT_VOLUME);
|
|
}
|
|
setOutputVolume(a0) {
|
|
let r5 = a0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (a0 == null) {
|
|
r5 = DEFAULT_VOLUME;
|
|
}
|
|
voiceEngine5.setOutputVolume(r5 / DEFAULT_VOLUME);
|
|
}
|
|
getAudioInputDevices() {
|
|
return _Module4356.getAudioInputDevices();
|
|
}
|
|
getNoiseCancellationStats() {
|
|
return new Promise((resolve) => {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.getNoiseCancellationStats != null) {
|
|
voiceEngine5.getNoiseCancellationStats((a0) => resolve(JSON.parse(a0)));
|
|
} else {
|
|
resolve(null);
|
|
}
|
|
});
|
|
}
|
|
setNoiseCancellationEnableStats(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setNoiseCancellationEnableStats2 = voiceEngine5.setNoiseCancellationEnableStats;
|
|
if (setNoiseCancellationEnableStats2 != null) {
|
|
setNoiseCancellationEnableStats2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setAudioInputDevice(a0) {
|
|
const audioInputDeviceId = this.audioInputDeviceId;
|
|
this.audioInputDeviceId = a0;
|
|
if (supportsFeature(NativeFeatures.SET_AUDIO_DEVICE_BY_ID)) {
|
|
getVoiceEngine().setInputDevice(a0);
|
|
} else {
|
|
_Module4356.getAudioInputDevices().then((result) => {
|
|
let r5 = result.find((item) => item.id === a0);
|
|
if (r5 == null) {
|
|
r5 = result[0];
|
|
}
|
|
if (r5 != null) {
|
|
getVoiceEngine().setInputDevice(r5.index);
|
|
}
|
|
});
|
|
}
|
|
this.emit(MediaEngineEvent.SelectedDeviceChange, DeviceTypes.AUDIO_INPUT, audioInputDeviceId, a0);
|
|
}
|
|
getAudioOutputDevices() {
|
|
return _Module4356.getAudioOutputDevices();
|
|
}
|
|
setAudioOutputDevice(a0) {
|
|
const audioOutputDeviceId = this.audioOutputDeviceId;
|
|
this.audioOutputDeviceId = a0;
|
|
if (supportsFeature(NativeFeatures.SET_AUDIO_DEVICE_BY_ID)) {
|
|
getVoiceEngine().setOutputDevice(a0);
|
|
} else {
|
|
_Module4356.getAudioOutputDevices().then((result) => {
|
|
let r5 = result.find((item) => item.id === a0);
|
|
if (r5 == null) {
|
|
r5 = result[0];
|
|
}
|
|
if (r5 != null) {
|
|
getVoiceEngine().setOutputDevice(r5.index);
|
|
}
|
|
});
|
|
}
|
|
this.emit(MediaEngineEvent.SelectedDeviceChange, DeviceTypes.AUDIO_OUTPUT, audioOutputDeviceId, a0);
|
|
}
|
|
getVideoInputDevices() {
|
|
return _Module4356.getVideoInputDevices();
|
|
}
|
|
async setVideoInputDevice(a0) {
|
|
let env14092 = {
|
|
$parent: env2524
|
|
};
|
|
env14092[0] = a0;
|
|
env14092[1] = this;
|
|
let env29307;
|
|
const r24 = env14092;
|
|
let c25025_1 = r24;
|
|
const r11 = env29307 = {
|
|
$parent: r24
|
|
};
|
|
let c25025_0 = r11;
|
|
env29307[0] = void 0;
|
|
env29307[1] = void 0;
|
|
env29307[2] = void 0;
|
|
env29307[0] = (await env14092[1].getVideoInputDevices()).find($mk114498(env14092));
|
|
env29307[1] = env29307[0] != null ? env29307[0].id : DISABLED_DEVICE_ID;
|
|
if (env29307[1] !== env14092[1].videoInputDeviceId) {
|
|
env14092[1].videoInputDeviceId = env29307[1];
|
|
if (supportsFeature(NativeFeatures.SET_VIDEO_DEVICE_BY_ID)) {
|
|
env29307[2] = env29307[0] != null ? env29307[0].originalId != null && env29307[0].originalId !== "" ? env29307[0].originalId : env29307[0].id : DISABLED_DEVICE_ID;
|
|
getVoiceEngine().setVideoInputDevice(env29307[2]);
|
|
} else {
|
|
getVoiceEngine().setVideoInputDevice(env29307[0] != null ? env29307[0].index : -1);
|
|
}
|
|
env14092[1].connections.forEach($mk114499(env14092));
|
|
}
|
|
}
|
|
getVideoInputDeviceId() {
|
|
return this.videoInputDeviceId;
|
|
}
|
|
setAsyncVideoInputDeviceInit(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setAsyncVideoInputDeviceInitSetting = voiceEngine5.setAsyncVideoInputDeviceInitSetting;
|
|
if (setAsyncVideoInputDeviceInitSetting != null) {
|
|
setAsyncVideoInputDeviceInitSetting.call(voiceEngine5, a0);
|
|
}
|
|
const voiceEngine6 = getVoiceEngine();
|
|
const setAsyncVideoInputDeviceInit2 = voiceEngine6.setAsyncVideoInputDeviceInit;
|
|
if (setAsyncVideoInputDeviceInit2 != null) {
|
|
setAsyncVideoInputDeviceInit2.call(voiceEngine6, a0);
|
|
}
|
|
}
|
|
getCodecCapabilities(a0) {
|
|
getVoiceEngine().getCodecCapabilities(a0);
|
|
}
|
|
setGoLiveSource(a0, a1) {
|
|
let c14093_1 = a0;
|
|
if (a0 != null) {
|
|
this.eachConnection((a0) => {
|
|
if (!(a1 === MediaEngineContextTypes.STREAM && a0.streamUserId !== a0.userId)) {
|
|
a0.setGoLiveSource(c14093_1);
|
|
a0.setVideoBroadcast(this.shouldConnectionBroadcastVideo(a0));
|
|
}
|
|
}, a1);
|
|
} else {
|
|
this.eachConnection((a0) => {
|
|
a0.clearDesktopSource();
|
|
a0.clearGoLiveDevices();
|
|
a0.setSoundshareSource(0, false);
|
|
a0.setVideoBroadcast(this.shouldConnectionBroadcastVideo(a0));
|
|
}, a1);
|
|
}
|
|
}
|
|
setClipsSource(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.setClipsSource != null && voiceEngine5.setOnClipsRecordingEvent != null && voiceEngine5.applyClipsSettings != null) {
|
|
if (a0 != null) {
|
|
const quality = a0.quality;
|
|
const { frameRate, resolution } = quality;
|
|
const width = resolution <= 480 ? resolution / 3 * 4 : resolution / 9 * 16;
|
|
const desktopDescription = a0.desktopDescription;
|
|
const { id, soundshareId, useLoopback, useVideoHook, useHookFramePacer, useGraphicsCapture, useQuartzCapturer, allowScreenCaptureKit, hdrCaptureMode, videoHookAllowDx12, minCaptureWidth, minCaptureHeight } = desktopDescription;
|
|
this.clipsRecordingEventContext = {
|
|
id,
|
|
soundshareId,
|
|
applicationName: a0.applicationName
|
|
};
|
|
this.registerClipsRecordingEventHandler();
|
|
const applyClipsSettings = voiceEngine5.applyClipsSettings;
|
|
if (applyClipsSettings != null) {
|
|
const bitratePercent = a0.bitratePercent;
|
|
applyClipsSettings.call(voiceEngine5, {
|
|
useVideoHook,
|
|
useHookFramePacer,
|
|
useGraphicsCapture,
|
|
useQuartzCapturer,
|
|
allowScreenCaptureKit,
|
|
hdrCaptureMode,
|
|
videoHookAllowDx12,
|
|
soundshareLoopback: useLoopback,
|
|
frameRate,
|
|
width,
|
|
height: resolution,
|
|
bitrateKbps: bitratePercent != null ? Math.round(6000 * Math.min(100, Math.max(10, bitratePercent)) / 100) : void 0,
|
|
videoEncoderExperiments: a0.videoEncoderExperiments,
|
|
minCaptureWidth,
|
|
minCaptureHeight
|
|
});
|
|
}
|
|
const r71 = _slicedToArray(id != null ? id.split(":") : ["", ""], 2);
|
|
r71[0];
|
|
voiceEngine5.setClipsSource({
|
|
id: r71[1],
|
|
soundshareId: soundshareId ?? 0
|
|
});
|
|
} else {
|
|
voiceEngine5.setClipsSource({
|
|
id: "",
|
|
soundshareId: 0
|
|
});
|
|
}
|
|
}
|
|
}
|
|
setClipsQualitySettings(a0, a1, a2, a3) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.applyClipsQualitySettings == null) {
|
|
return false;
|
|
}
|
|
voiceEngine5.applyClipsQualitySettings(a0, a1, a2);
|
|
const bitrateKbps = a3 != null ? Math.round(6000 * Math.min(100, Math.max(10, a3)) / 100) : void 0;
|
|
if (bitrateKbps != null && voiceEngine5.applyClipsSettings != null) {
|
|
voiceEngine5.applyClipsSettings({
|
|
bitrateKbps
|
|
});
|
|
}
|
|
return true;
|
|
}
|
|
setSoundshareSource(c14094_0, c14094_1, a2) {
|
|
this.eachConnection((a0) => {
|
|
if (!(a2 === MediaEngineContextTypes.STREAM && a0.streamUserId !== a0.userId)) {
|
|
a0.setSoundshareSource(c14094_0, c14094_1);
|
|
}
|
|
}, a2);
|
|
}
|
|
getDesktopSource() {
|
|
return Promise.reject(new Error("NO_STREAM"));
|
|
}
|
|
getScreenPreviews(c14095_0, c14095_1, a2) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.setPreviewsUseWgc != null) {
|
|
voiceEngine5.setPreviewsUseWgc(a2);
|
|
}
|
|
return new Promise((resolve) => {
|
|
if (getVoiceEngine().getScreenPreviews != null) {
|
|
getVoiceEngine().getScreenPreviews(c14095_0, c14095_1, (a0) => {
|
|
resolve(a0.map((item, index) => ({
|
|
...item,
|
|
name: "Screen " + (index + 1)
|
|
})));
|
|
});
|
|
} else {
|
|
resolve([]);
|
|
}
|
|
});
|
|
}
|
|
setClipsModulePath(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsModulePath2 = voiceEngine5.setClipsModulePath;
|
|
if (setClipsModulePath2 != null) {
|
|
setClipsModulePath2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setClipsDataPath(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsDataPath2 = voiceEngine5.setClipsDataPath;
|
|
if (setClipsDataPath2 != null) {
|
|
setClipsDataPath2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setClipsSentryConfig(a0, a1, a2) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsSentryConfig2 = voiceEngine5.setClipsSentryConfig;
|
|
if (setClipsSentryConfig2 != null) {
|
|
setClipsSentryConfig2.call(voiceEngine5, a0, a1, a2);
|
|
}
|
|
}
|
|
setClipsV3Enabled(a0) {
|
|
if (a0) {
|
|
this.registerClipsRecordingEventHandler();
|
|
}
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsV3Enabled2 = voiceEngine5.setClipsV3Enabled;
|
|
if (setClipsV3Enabled2 != null) {
|
|
setClipsV3Enabled2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
registerClipsRecordingEventHandler() {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (!(voiceEngine5.setOnClipsRecordingEvent == null || this.clipsRecordingEventHandlerRegistered)) {
|
|
this.clipsRecordingEventHandlerRegistered = true;
|
|
voiceEngine5.setOnClipsRecordingEvent((a0, a1) => {
|
|
const clipsRecordingEventContext = this.clipsRecordingEventContext;
|
|
const { id, soundshareId, applicationName } = clipsRecordingEventContext;
|
|
this.logger.info(`Clips recording event: ${ClipsRecordingEvent[a0]} received for stream ${id} and sound ${soundshareId}.`);
|
|
if (a0 === ClipsRecordingEvent.GoLiveEnded) {
|
|
this.emit(MediaEngineEvent.ClipsRecordingRestartNeeded);
|
|
} else if (a0 === ClipsRecordingEvent.Error) {
|
|
this.emit(MediaEngineEvent.ClipsInitFailure, a1 != null ? a1 !== "" ? a1 : "Failed to set clips source in media engine" : "Failed to set clips source in media engine", applicationName);
|
|
} else if (a0 === ClipsRecordingEvent.IdleShutdown) {
|
|
this.emit(MediaEngineEvent.ClipsBridgeIdleShutdown);
|
|
} else if (a0 === ClipsRecordingEvent.RecordingHealthy) {
|
|
this.emit(MediaEngineEvent.ClipsRecordingHealthy);
|
|
} else if (a0 === ClipsRecordingEvent.RecordingActive) {
|
|
this.emit(MediaEngineEvent.ClipsRecordingReadyChanged, true);
|
|
} else if (a0 === ClipsRecordingEvent.RecordingInactive) {
|
|
this.emit(MediaEngineEvent.ClipsRecordingReadyChanged, false);
|
|
} else if (!(a0 !== ClipsRecordingEvent.Ended && a0 !== ClipsRecordingEvent.StoppedByGoLive)) {
|
|
this.emit(MediaEngineEvent.ClipsRecordingEnded, id, soundshareId);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
setClipsUIActive(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsUIActive2 = voiceEngine5.setClipsUIActive;
|
|
if (setClipsUIActive2 != null) {
|
|
setClipsUIActive2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setClipsV3MLEnabled(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsV3MLEnabled2 = voiceEngine5.setClipsV3MLEnabled;
|
|
if (setClipsV3MLEnabled2 != null) {
|
|
setClipsV3MLEnabled2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setClipsRecordingEnabled(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipsRecordingEnabled2 = voiceEngine5.setClipsRecordingEnabled;
|
|
if (setClipsRecordingEnabled2 != null) {
|
|
setClipsRecordingEnabled2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
hasSetClipsRecordingEnabled() {
|
|
return getVoiceEngine().setClipsRecordingEnabled != null;
|
|
}
|
|
setClipBufferLength(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setClipBufferLength2 = voiceEngine5.setClipBufferLength;
|
|
if (setClipBufferLength2 != null) {
|
|
setClipBufferLength2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
getSystemSteadyClockNowMs() {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const getSystemSteadyClockNowMs2 = voiceEngine5.getSystemSteadyClockNowMs;
|
|
let r11 = getSystemSteadyClockNowMs2 == null ? void 0 : getSystemSteadyClockNowMs2.call(voiceEngine5);
|
|
if (r11 == null) {
|
|
r11 = null;
|
|
}
|
|
return r11;
|
|
}
|
|
saveClipEx(c14097_0) {
|
|
const voiceEngine = getVoiceEngine();
|
|
return new Promise((c25027_0, reject) => {
|
|
const onSuccess2 = function onSuccess(a0, a1, a2, a3) {
|
|
let clipStats;
|
|
try {
|
|
clipStats = JSON.parse(a1 !== "" ? a1 : "{}");
|
|
} catch ($e) {
|
|
clipStats = {};
|
|
}
|
|
const r12 = {
|
|
duration: a0,
|
|
clipStats
|
|
};
|
|
if (a2 !== void 0 && a2.length > 0) {
|
|
r12.thumbnail = a2;
|
|
}
|
|
if (a3 !== void 0 && a3.length > 0) {
|
|
r12.metadata = a3;
|
|
}
|
|
return c25027_0(r12);
|
|
};
|
|
const onFailure = function onFailure(a0) {
|
|
let r10;
|
|
try {
|
|
r10 = reject(JSON.parse(a0 !== "" ? a0 : "{}"));
|
|
} catch ($e) {
|
|
return reject({
|
|
errorMessage: "clip save failed",
|
|
errorAt: "unknown"
|
|
});
|
|
}
|
|
return r10;
|
|
};
|
|
if (voiceEngine.saveClipEx == null) {
|
|
const { filepath, metadata, thumbnailMs } = c14097_0;
|
|
let startMs = c14097_0.startMs;
|
|
let endMs = c14097_0.endMs;
|
|
let trimStartMs = c14097_0.trimStartMs;
|
|
let trimEndMs = c14097_0.trimEndMs;
|
|
const userId = c14097_0.userId;
|
|
const r3 = userId != null;
|
|
if (r3 ? voiceEngine.saveClipForUser == null && voiceEngine.saveClipForUserWithTime == null : voiceEngine.setClipBufferLength == null || voiceEngine.saveClip == null && voiceEngine.saveClipWithTime == null) {
|
|
reject("unsupported");
|
|
} else {
|
|
const onLegacySuccess = function onLegacySuccess(a0, a1, a2) {
|
|
return onSuccess2(a0, a2, a1, void 0);
|
|
};
|
|
const onLegacyTimeSuccess = function onLegacyTimeSuccess(a0, a1, a2) {
|
|
return onSuccess2(a0, a1, void 0, a2);
|
|
};
|
|
if (r3) {
|
|
if (voiceEngine.saveClipForUserWithTime != null) {
|
|
if (startMs == null) {
|
|
startMs = null;
|
|
}
|
|
if (endMs == null) {
|
|
endMs = null;
|
|
}
|
|
if (trimStartMs == null) {
|
|
trimStartMs = null;
|
|
}
|
|
if (trimEndMs == null) {
|
|
trimEndMs = null;
|
|
}
|
|
voiceEngine.saveClipForUserWithTime(userId, filepath, metadata, startMs, endMs, trimStartMs, trimEndMs, onLegacyTimeSuccess, onFailure, thumbnailMs);
|
|
} else {
|
|
const r85 = supportsFeature(NativeFeatures.CLIPS_THUMBNAIL);
|
|
const saveClipForUser = voiceEngine.saveClipForUser;
|
|
if (r85) {
|
|
if (saveClipForUser != null) {
|
|
saveClipForUser.call(voiceEngine, userId, filepath, metadata, onLegacySuccess, onFailure, thumbnailMs);
|
|
}
|
|
} else if (saveClipForUser != null) {
|
|
saveClipForUser.call(voiceEngine, userId, filepath, metadata, onLegacySuccess, onFailure);
|
|
}
|
|
}
|
|
} else if (voiceEngine.saveClipWithTime != null) {
|
|
voiceEngine.saveClipWithTime(filepath, metadata, startMs == null ? null : startMs, endMs == null ? null : endMs, trimStartMs == null ? null : trimStartMs, trimEndMs == null ? null : trimEndMs, onLegacyTimeSuccess, onFailure, thumbnailMs);
|
|
} else {
|
|
const r56 = supportsFeature(NativeFeatures.CLIPS_THUMBNAIL);
|
|
const saveClip = voiceEngine.saveClip;
|
|
if (r56) {
|
|
if (saveClip != null) {
|
|
saveClip.call(voiceEngine, filepath, metadata, onLegacySuccess, onFailure, thumbnailMs);
|
|
}
|
|
} else if (saveClip != null) {
|
|
saveClip.call(voiceEngine, filepath, metadata, onLegacySuccess, onFailure);
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
voiceEngine.saveClipEx(c14097_0, onSuccess2, onFailure);
|
|
}
|
|
});
|
|
}
|
|
updateClipMetadata(c14098_0, c14098_1) {
|
|
const voiceEngine2 = getVoiceEngine();
|
|
return voiceEngine2.updateClipMetadata == null ? Promise.reject("unsupported") : new Promise((resolve, reject) => {
|
|
voiceEngine2.updateClipMetadata(c14098_0, c14098_1, resolve, reject);
|
|
});
|
|
}
|
|
saveScreenshot(c14099_0, c14099_1, c14099_2, c14099_3, c14099_4) {
|
|
const voiceEngine3 = getVoiceEngine();
|
|
return voiceEngine3.saveScreenshot == null ? Promise.reject("unsupported") : new Promise((c25028_0, reject) => {
|
|
let r6 = c14099_3;
|
|
if (r6 == null) {
|
|
r6 = "";
|
|
}
|
|
let r19 = c14099_4;
|
|
if (r19 == null) {
|
|
r19 = 0;
|
|
}
|
|
voiceEngine3.saveScreenshot(c14099_0, c14099_1, r6, c14099_2, r19, (a0) => {
|
|
c25028_0(Buffer.from(a0));
|
|
}, reject);
|
|
});
|
|
}
|
|
exportClip(c14100_0, c14100_1) {
|
|
const voiceEngine4 = getVoiceEngine();
|
|
return voiceEngine4.exportClip == null ? Promise.reject("unsupported") : new Promise((c25029_0, reject) => {
|
|
voiceEngine4.exportClip(c14100_0, c14100_1, (a0) => c25029_0(new Blob([a0])), reject);
|
|
});
|
|
}
|
|
hasExportClipToFile() {
|
|
return getVoiceEngine().exportClipToFile != null;
|
|
}
|
|
setClipsPerfMonitoring(a0, a1, a2) {
|
|
const setClipsPerfMonitoring2 = getVoiceEngine().setClipsPerfMonitoring;
|
|
return setClipsPerfMonitoring2 == null ? Promise.reject("unsupported") : setClipsPerfMonitoring2(a0, a1, a2);
|
|
}
|
|
exportClipToFile(c14101_0, c14101_1, c14101_2) {
|
|
const exportClipToFile2 = getVoiceEngine().exportClipToFile;
|
|
return exportClipToFile2 == null ? Promise.reject("unsupported") : new Promise((c25030_0, reject) => {
|
|
exportClipToFile2(c14101_0, c14101_1, c14101_2, (a0, a1) => {
|
|
if (typeof a0 === "string") {
|
|
c25030_0({
|
|
filepath: a0,
|
|
formattedForUpload: a1 === true
|
|
});
|
|
} else {
|
|
reject("unsupported: native exportClipToFile returned non-string");
|
|
}
|
|
}, reject);
|
|
});
|
|
}
|
|
getWindowPreviews(c14102_0, c14102_1, a2) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.setPreviewsUseWgc != null) {
|
|
voiceEngine5.setPreviewsUseWgc(a2);
|
|
}
|
|
return new Promise((resolve) => {
|
|
if (getVoiceEngine().getWindowPreviews != null) {
|
|
getVoiceEngine().getWindowPreviews(c14102_0, c14102_1, (a0) => {
|
|
resolve(a0);
|
|
});
|
|
} else {
|
|
resolve([]);
|
|
}
|
|
});
|
|
}
|
|
async getSingleWindowPreview(c14103_0, c14103_1, c14103_2, c14103_3) {
|
|
let r68;
|
|
let c29308_0;
|
|
L16: {
|
|
c29308_0 = void 0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.setPreviewsUseWgc != null) {
|
|
voiceEngine5.setPreviewsUseWgc(c14103_3);
|
|
}
|
|
if (getVoiceEngine().getSingleWindowPreview != null) {
|
|
c29308_0 = await getVoiceEngine().getSingleWindowPreview(c14103_0, c14103_1, c14103_2);
|
|
const r67 = c29308_0.length > 0;
|
|
r68 = null;
|
|
if (!r67) {
|
|
break L16;
|
|
}
|
|
r68 = c29308_0[0];
|
|
break L16;
|
|
}
|
|
return null;
|
|
}
|
|
return r68;
|
|
}
|
|
setAudioSubsystem(a0) {
|
|
if (getVoiceEngine().setAudioSubsystem != null) {
|
|
getVoiceEngine().setAudioSubsystem(a0);
|
|
} else {
|
|
getVoiceEngine().setUseLegacyAudioDevice(a0 === AudioSubsystems.LEGACY);
|
|
}
|
|
}
|
|
setOffloadAdmControls(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.setOffloadAdmControls != null) {
|
|
voiceEngine5.setOffloadAdmControls(a0);
|
|
}
|
|
}
|
|
updateFieldTrial(a0, a1) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const updateFieldTrial2 = voiceEngine5.updateFieldTrial;
|
|
if (updateFieldTrial2 != null) {
|
|
updateFieldTrial2.call(voiceEngine5, a0, a1);
|
|
}
|
|
}
|
|
queueAudioSubsystem(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.queueAudioSubsystem != null) {
|
|
voiceEngine5.queueAudioSubsystem(a0);
|
|
} else {
|
|
this.setAudioSubsystem(a0);
|
|
}
|
|
}
|
|
getAudioSubsystem() {
|
|
return this.audioSubsystem;
|
|
}
|
|
getAudioLayer() {
|
|
return this.audioLayer;
|
|
}
|
|
getDebugLogging() {
|
|
return !!this.supports(Features.DEBUG_LOGGING) && getVoiceEngine().getDebugLogging();
|
|
}
|
|
setDebugLogging(a0) {
|
|
if (this.supports(Features.DEBUG_LOGGING)) {
|
|
getVoiceEngine().setDebugLogging(a0);
|
|
}
|
|
}
|
|
setLoopback(a0, a1) {
|
|
let r4 = a0;
|
|
if (getVoiceEngine().setLoopback != null) {
|
|
getVoiceEngine().setLoopback(a0, {
|
|
echoCancellation: a1.echoCancellation,
|
|
noiseSuppression: a1.noiseSuppression,
|
|
automaticGainControl: a1.automaticGainControlConfig?.enabled,
|
|
automaticGainControlConfig: a1.automaticGainControlConfig,
|
|
noiseCancellation: a1.noiseCancellation,
|
|
noiseCancellationDuringProcessing: a1.noiseCancellationDuringProcessing
|
|
});
|
|
}
|
|
if (getVoiceEngine().setEmitVADLevel2 != null) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (!a0) {
|
|
r4 = this.listenerCount(MediaEngineEvent.VoiceActivity) > 0;
|
|
}
|
|
voiceEngine5.setEmitVADLevel2(r4);
|
|
} else {
|
|
getVoiceEngine().setEmitVADLevel(a0 ? a0 : this.listenerCount(MediaEngineEvent.VoiceActivity) > 0, a0, {
|
|
echoCancellation: a1.echoCancellation,
|
|
noiseSuppression: a1.noiseSuppression,
|
|
automaticGainControl: a1.automaticGainControlConfig?.enabled,
|
|
noiseCancellation: a1.noiseCancellation,
|
|
noiseCancellationDuringProcessing: a1.noiseCancellationDuringProcessing
|
|
});
|
|
}
|
|
}
|
|
getLoopback() {
|
|
return false;
|
|
}
|
|
getCodecSurvey() {
|
|
return this.codecSurvey != null ? Promise.resolve(this.codecSurvey) : new Promise((c25033_0, reject) => {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.getCodecSurvey != null) {
|
|
voiceEngine5.getCodecSurvey((a0) => {
|
|
this.codecSurvey = a0;
|
|
c25033_0(a0);
|
|
});
|
|
} else {
|
|
reject(new Error("getCodecSurvey is not implemented."));
|
|
}
|
|
});
|
|
}
|
|
writeAudioDebugState() {
|
|
return new Promise((resolve, reject) => {
|
|
const writeAudioDebugState2 = getVoiceEngine().writeAudioDebugState;
|
|
if (writeAudioDebugState2 != null) {
|
|
writeAudioDebugState2();
|
|
resolve();
|
|
} else {
|
|
reject(new Error("Audio debug state is not supported."));
|
|
}
|
|
});
|
|
}
|
|
startAecDump() {}
|
|
stopAecDump() {}
|
|
setAecDump(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setAecDump2 = voiceEngine5.setAecDump;
|
|
if (setAecDump2 != null) {
|
|
setAecDump2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
startRecordingRawSamples(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const startRecordingRawSamples2 = voiceEngine5.startRecordingRawSamples;
|
|
if (startRecordingRawSamples2 != null) {
|
|
startRecordingRawSamples2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
stopRecordingRawSamples() {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const stopRecordingRawSamples2 = voiceEngine5.stopRecordingRawSamples;
|
|
if (stopRecordingRawSamples2 != null) {
|
|
stopRecordingRawSamples2.call(voiceEngine5);
|
|
}
|
|
}
|
|
processBatchAudioFiles(a0, a1, a2, a3) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const processBatchAudioFiles2 = voiceEngine5.processBatchAudioFiles;
|
|
if (processBatchAudioFiles2 != null) {
|
|
processBatchAudioFiles2.call(voiceEngine5, a0, a1, a2, a3);
|
|
}
|
|
}
|
|
cancelBatchAudioProcessing() {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const cancelBatchAudioProcessing2 = voiceEngine5.cancelBatchAudioProcessing;
|
|
if (cancelBatchAudioProcessing2 != null) {
|
|
cancelBatchAudioProcessing2.call(voiceEngine5);
|
|
}
|
|
}
|
|
rankRtcRegions(c14105_0) {
|
|
return new Promise((c25034_0, reject) => {
|
|
const rankRtcRegions2 = getVoiceEngine().rankRtcRegions;
|
|
if (rankRtcRegions2 != null) {
|
|
rankRtcRegions2(c14105_0, (a0) => c25034_0(a0));
|
|
} else {
|
|
reject(new Error("RTC region latency test is not supported."));
|
|
}
|
|
});
|
|
}
|
|
createReplayConnection(a0, a1) {
|
|
const replay = Module4296.createReplay(a0, a1);
|
|
let r14 = null;
|
|
if (replay != null) {
|
|
replay.on(BaseConnectionEvent.Destroy, (a0) => {
|
|
this.connections.delete(a0);
|
|
if (this.connectionsEmpty()) {
|
|
setProcessPriority(ProcessPriority.NORMAL);
|
|
}
|
|
});
|
|
this.connections.add(replay);
|
|
setProcessPriority(ProcessPriority.HIGH);
|
|
this.emit(MediaEngineEvent.Connection, replay);
|
|
r14 = replay;
|
|
}
|
|
return r14;
|
|
}
|
|
setOnVideoContainerResized(a0) {
|
|
Video.onContainerResized = a0;
|
|
}
|
|
setMaxSyncDelayOverride(a0) {
|
|
const setMaxSyncDelayOverride2 = getVoiceEngine().setMaxSyncDelayOverride;
|
|
if (setMaxSyncDelayOverride2 != null) {
|
|
setMaxSyncDelayOverride2(a0);
|
|
}
|
|
}
|
|
applyMediaFilterSettings(a0) {
|
|
let r19;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const { applyMediaFilterSettings: applyMediaFilterSettings2, applyMediaFilterSettingsWithCallback } = voiceEngine5;
|
|
if (applyMediaFilterSettingsWithCallback != null) {
|
|
r19 = new Promise((resolve) => {
|
|
applyMediaFilterSettingsWithCallback(a0, resolve);
|
|
});
|
|
} else {
|
|
if (applyMediaFilterSettings2 != null) {
|
|
applyMediaFilterSettings2(a0);
|
|
}
|
|
r19 = Promise.resolve();
|
|
}
|
|
return r19;
|
|
}
|
|
startLocalAudioRecording(c14108_0) {
|
|
return new Promise((c25035_0, reject) => {
|
|
const startLocalAudioRecording2 = getVoiceEngine().startLocalAudioRecording;
|
|
if (startLocalAudioRecording2 != null) {
|
|
startLocalAudioRecording2(c14108_0, (a0) => {
|
|
if (a0) {
|
|
c25035_0();
|
|
} else {
|
|
reject(new Error("Failed to start local audio recording."));
|
|
}
|
|
});
|
|
} else {
|
|
reject(new Error("startLocalAudioRecording is not supported."));
|
|
}
|
|
});
|
|
}
|
|
stopLocalAudioRecording(c14109_0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const stopLocalAudioRecording2 = voiceEngine5.stopLocalAudioRecording;
|
|
if (stopLocalAudioRecording2 != null) {
|
|
stopLocalAudioRecording2.call(voiceEngine5, (a0, a1) => {
|
|
c14109_0(a0, a1);
|
|
});
|
|
}
|
|
if (this.listenerCount(MediaEngineEvent.VoiceActivity) > 0 && getVoiceEngine().setEmitVADLevel2 != null) {
|
|
getVoiceEngine().setEmitVADLevel2(true);
|
|
}
|
|
}
|
|
setHasFullbandPerformance(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setHasFullbandPerformance2 = voiceEngine5.setHasFullbandPerformance;
|
|
if (setHasFullbandPerformance2 != null) {
|
|
setHasFullbandPerformance2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setNcModels(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setNcModels2 = voiceEngine5.setNcModels;
|
|
if (setNcModels2 != null) {
|
|
setNcModels2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
getSupportedSecureFramesProtocolVersion() {
|
|
let SupportedSecureFramesProtocolVersion = getVoiceEngine().SupportedSecureFramesProtocolVersion;
|
|
if (SupportedSecureFramesProtocolVersion == null) {
|
|
SupportedSecureFramesProtocolVersion = 0;
|
|
}
|
|
return SupportedSecureFramesProtocolVersion;
|
|
}
|
|
getSupportedBandwidthEstimationExperiments(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const getSupportedBandwidthEstimationExperiments2 = voiceEngine5.getSupportedBandwidthEstimationExperiments;
|
|
if (getSupportedBandwidthEstimationExperiments2 != null) {
|
|
getSupportedBandwidthEstimationExperiments2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
getMLSSigningKey(c14110_0, c14110_1) {
|
|
return new Promise((c25036_0, reject) => {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
if (voiceEngine5.getMLSSigningKey != null) {
|
|
voiceEngine5.getMLSSigningKey(c14110_0, c14110_1, (a0, a1) => c25036_0({
|
|
key: a0,
|
|
signature: a1
|
|
}));
|
|
} else {
|
|
reject(new Error("NOT_IMPLEMENTED"));
|
|
}
|
|
});
|
|
}
|
|
setSidechainCompression(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setSidechainCompression2 = voiceEngine5.setSidechainCompression;
|
|
if (setSidechainCompression2 != null) {
|
|
setSidechainCompression2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setSidechainCompressionStrength(a0) {
|
|
const r0 = 100 - a0;
|
|
const threshold = SIDECHAIN_COMPRESSION_MIN_THRESHOLD + (SIDECHAIN_COMPRESSION_MAX_THRESHOLD - SIDECHAIN_COMPRESSION_MIN_THRESHOLD) * r0 / 100;
|
|
const ratio = SIDECHAIN_COMPRESSION_MIN_RATIO + (SIDECHAIN_COMPRESSION_MAX_RATIO - SIDECHAIN_COMPRESSION_MIN_RATIO) * r0 / 100;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const applySidechainCompressionSettings = voiceEngine5.applySidechainCompressionSettings;
|
|
if (applySidechainCompressionSettings != null) {
|
|
applySidechainCompressionSettings.call(voiceEngine5, {
|
|
threshold,
|
|
ratio
|
|
});
|
|
}
|
|
}
|
|
setVoiceSampleRateCap(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setVoiceSampleRateCap2 = voiceEngine5.setVoiceSampleRateCap;
|
|
if (setVoiceSampleRateCap2 != null) {
|
|
setVoiceSampleRateCap2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setVoiceChannelCountCap(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setVoiceChannelCountCap2 = voiceEngine5.setVoiceChannelCountCap;
|
|
if (setVoiceChannelCountCap2 != null) {
|
|
setVoiceChannelCountCap2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
setNativeDesktopVideoSourcePickerActive(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const setNativeDesktopVideoSourcePickerActive2 = voiceEngine5.setNativeDesktopVideoSourcePickerActive;
|
|
if (setNativeDesktopVideoSourcePickerActive2 != null) {
|
|
setNativeDesktopVideoSourcePickerActive2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
presentNativeScreenSharePicker(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const presentNativeScreenSharePicker2 = voiceEngine5.presentNativeScreenSharePicker;
|
|
if (presentNativeScreenSharePicker2 != null) {
|
|
presentNativeScreenSharePicker2.call(voiceEngine5, a0 == null ? "" : a0);
|
|
}
|
|
}
|
|
releaseNativeDesktopVideoSourcePickerStream() {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const releaseNativeDesktopVideoSourcePickerStream2 = voiceEngine5.releaseNativeDesktopVideoSourcePickerStream;
|
|
if (releaseNativeDesktopVideoSourcePickerStream2 != null) {
|
|
releaseNativeDesktopVideoSourcePickerStream2.call(voiceEngine5);
|
|
}
|
|
}
|
|
async getSystemMicrophoneMode() {
|
|
let r24 = void 0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const getSystemMicrophoneMode2 = voiceEngine5.getSystemMicrophoneMode;
|
|
if (getSystemMicrophoneMode2 != null) {
|
|
r24 = getSystemMicrophoneMode2.call(voiceEngine5);
|
|
}
|
|
let value = await r24;
|
|
if (value == null) {
|
|
value = "";
|
|
}
|
|
return value;
|
|
}
|
|
showSystemCaptureConfigurationUI(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const showSystemCaptureConfigurationUI2 = voiceEngine5.showSystemCaptureConfigurationUI;
|
|
if (showSystemCaptureConfigurationUI2 != null) {
|
|
showSystemCaptureConfigurationUI2.call(voiceEngine5, a0);
|
|
}
|
|
}
|
|
fetchAsyncResources() {
|
|
return Promise.resolve();
|
|
}
|
|
async getDeviceOSVolume(c14111_0) {
|
|
let r25 = void 0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const getDeviceOSVolume2 = voiceEngine5.getDeviceOSVolume;
|
|
if (getDeviceOSVolume2 != null) {
|
|
r25 = getDeviceOSVolume2.call(voiceEngine5, c14111_0);
|
|
}
|
|
return await r25;
|
|
}
|
|
async getDeviceOSMuted(c14112_0) {
|
|
let r25 = void 0;
|
|
const voiceEngine5 = getVoiceEngine();
|
|
const getDeviceOSMuted2 = voiceEngine5.getDeviceOSMuted;
|
|
if (getDeviceOSMuted2 != null) {
|
|
r25 = getDeviceOSMuted2.call(voiceEngine5, c14112_0);
|
|
}
|
|
return await r25;
|
|
}
|
|
getDeviceAudioEffects(a0) {
|
|
const voiceEngine5 = getVoiceEngine();
|
|
return voiceEngine5.getDeviceAudioEffects != null ? voiceEngine5.getDeviceAudioEffects(a0) : Promise.reject(new Error("Device audio effect querying not supported"));
|
|
}
|
|
watchdogTick() {
|
|
let c14113_0 = false;
|
|
getVoiceEngine().pingVoiceThread(() => {
|
|
c14113_0 = true;
|
|
this.consecutiveWatchdogFailures = 0;
|
|
});
|
|
setTimeout(() => {
|
|
if (!c14113_0) {
|
|
const consecutiveWatchdogFailures = this.consecutiveWatchdogFailures + 1;
|
|
this.consecutiveWatchdogFailures = consecutiveWatchdogFailures;
|
|
if (consecutiveWatchdogFailures > 1) {
|
|
this.emit(MediaEngineEvent.WatchdogTimeout);
|
|
} else {
|
|
this.watchdogTick();
|
|
}
|
|
} else {
|
|
this.watchdogTick();
|
|
}
|
|
}, WATCHDOG_TIMEOUT_MS);
|
|
}
|
|
connectionsEmpty() {
|
|
return this.connections.size === 0;
|
|
}
|
|
}
|
|
c2524_20 = MediaEngineNative;
|
|
export default MediaEngineNative;
|