diff --git a/ACKNOWLEDGMENTS.md b/ACKNOWLEDGMENTS.md index b1b8d09c31..2a05bb28d4 100644 --- a/ACKNOWLEDGMENTS.md +++ b/ACKNOWLEDGMENTS.md @@ -14350,7 +14350,7 @@ For more information on this, and how to apply and follow the GNU AGPL, see ``` -## libsignal-account-keys 0.1.0, libsignal-core 0.1.0, mrp 2.57.1, protobuf 2.57.1, ringrtc 2.57.1, regex-aot 0.1.0, partial-default-derive 0.1.0 +## libsignal-account-keys 0.1.0, libsignal-core 0.1.0, mrp 2.58.0, protobuf 2.58.0, ringrtc 2.58.0, regex-aot 0.1.0, partial-default-derive 0.1.0 ``` GNU AFFERO GENERAL PUBLIC LICENSE diff --git a/package.json b/package.json index be660999b3..4cf750d7d4 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "@signalapp/libsignal-client": "0.80.3", "@signalapp/minimask": "1.0.1", "@signalapp/quill-cjs": "2.1.2", - "@signalapp/ringrtc": "2.57.1", + "@signalapp/ringrtc": "2.58.0", "@signalapp/sqlcipher": "2.4.4", "@signalapp/windows-ucv": "1.0.1", "@tanstack/react-virtual": "3.11.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0ba2541895..3bd66144f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -135,8 +135,8 @@ importers: specifier: 2.1.2 version: 2.1.2 '@signalapp/ringrtc': - specifier: 2.57.1 - version: 2.57.1 + specifier: 2.58.0 + version: 2.58.0 '@signalapp/sqlcipher': specifier: 2.4.4 version: 2.4.4 @@ -3312,8 +3312,8 @@ packages: resolution: {integrity: sha512-y2sgqdivlrG41J4Zvt/82xtH/PZjDlgItqlD2g/Cv3ZbjlR6cGhTNXbfNygCJB8nXj+C7I28pjt1Zm3k0pv2mg==} engines: {npm: '>=8.2.3'} - '@signalapp/ringrtc@2.57.1': - resolution: {integrity: sha512-eFJvPRjMv1/CHniPw8Zn3vTIu5NdPxXn8rPMqswIhPFrhD5BSvtotIcrUWxHped7lc7GWvxVvSISQsUBACHLxA==} + '@signalapp/ringrtc@2.58.0': + resolution: {integrity: sha512-e72iWv7GlP84GKhbLKhsqEtc8QwJu6pPV5AbToXGD7ja6n6kqLGuyD3BkJqHn7jUvRS8VGQTprv1qJIWTLg56Q==} hasBin: true '@signalapp/sqlcipher@2.4.4': @@ -13983,7 +13983,7 @@ snapshots: lodash: 4.17.21 quill-delta: 5.1.0 - '@signalapp/ringrtc@2.57.1': + '@signalapp/ringrtc@2.58.0': dependencies: https-proxy-agent: 7.0.6 tar: 6.2.1 diff --git a/ts/services/calling.ts b/ts/services/calling.ts index aaaaba64b5..adcf11e904 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -508,6 +508,10 @@ export class CallingClass { RingRTC.handleOutgoingSignaling = this.#handleOutgoingSignaling.bind(this); RingRTC.handleIncomingCall = this.#handleIncomingCall.bind(this); RingRTC.handleStartCall = this.#handleStartCall.bind(this); + RingRTC.handleOutputDeviceChanged = + this.#handleOutputDeviceChanged.bind(this); + RingRTC.handleInputDeviceChanged = + this.#handleInputDeviceChanged.bind(this); RingRTC.handleAutoEndedIncomingCallRequest = this.#handleAutoEndedIncomingCallRequest.bind(this); RingRTC.handleLogMessage = this.#handleLogMessage.bind(this); @@ -2688,8 +2692,7 @@ export class CallingClass { return true; } - async #pollForMediaDevices(): Promise { - const newSettings = await this.getMediaDeviceSettings(); + async #maybeUpdateDevices(newSettings: MediaDeviceSettings): Promise { if ( !this.#mediaDeviceSettingsEqual( this.#lastMediaDeviceSettings, @@ -2708,10 +2711,19 @@ export class CallingClass { } } - async getAvailableIODevices(): Promise { + async #pollForMediaDevices(): Promise { + const newSettings = await this.getMediaDeviceSettings(); + return this.#maybeUpdateDevices(newSettings); + } + + async #getAvailableIODevicesWithPrefetchedDevices( + prefetchedMicrophones: Array | undefined, + prefetchedSpeakers: Array | undefined + ): Promise { const availableCameras = await this.#videoCapturer.enumerateDevices(); - const availableMicrophones = RingRTC.getAudioInputs(); - const availableSpeakers = RingRTC.getAudioOutputs(); + const availableMicrophones = + prefetchedMicrophones || RingRTC.getAudioInputs(); + const availableSpeakers = prefetchedSpeakers || RingRTC.getAudioOutputs(); return { availableCameras, @@ -2720,9 +2732,22 @@ export class CallingClass { }; } - async getMediaDeviceSettings(): Promise { + async getAvailableIODevices(): Promise { + return this.#getAvailableIODevicesWithPrefetchedDevices( + undefined, + undefined + ); + } + + async #getMediaDeviceSettingsWithPrefetchedDevices( + prefetchedMicrophones: Array | undefined, + prefetchedSpeakers: Array | undefined + ): Promise { const { availableCameras, availableMicrophones, availableSpeakers } = - await this.getAvailableIODevices(); + await this.#getAvailableIODevicesWithPrefetchedDevices( + prefetchedMicrophones, + prefetchedSpeakers + ); const preferredMicrophone = getPreferredAudioInputDevice(); const selectedMicIndex = findBestMatchingAudioDeviceIndex( @@ -2766,6 +2791,13 @@ export class CallingClass { }; } + async getMediaDeviceSettings(): Promise { + return this.#getMediaDeviceSettingsWithPrefetchedDevices( + undefined, + undefined + ); + } + setPreferredMicrophone(device: AudioDevice): void { log.info( 'MediaDevice: setPreferredMicrophone', @@ -3730,6 +3762,22 @@ export class CallingClass { return true; } + async #handleOutputDeviceChanged(devices: Array): Promise { + const newSettings = await this.#getMediaDeviceSettingsWithPrefetchedDevices( + undefined, + devices + ); + return this.#maybeUpdateDevices(newSettings); + } + + async #handleInputDeviceChanged(devices: Array): Promise { + const newSettings = await this.#getMediaDeviceSettingsWithPrefetchedDevices( + devices, + undefined + ); + return this.#maybeUpdateDevices(newSettings); + } + public async updateCallHistoryForAdhocCall( roomId: string, joinState: GroupCallJoinState | null,