mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-07-12 08:07:11 +01:00
Immediately handle audio device changes
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Generated
+5
-5
@@ -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
|
||||
|
||||
+55
-7
@@ -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<void> {
|
||||
const newSettings = await this.getMediaDeviceSettings();
|
||||
async #maybeUpdateDevices(newSettings: MediaDeviceSettings): Promise<void> {
|
||||
if (
|
||||
!this.#mediaDeviceSettingsEqual(
|
||||
this.#lastMediaDeviceSettings,
|
||||
@@ -2708,10 +2711,19 @@ export class CallingClass {
|
||||
}
|
||||
}
|
||||
|
||||
async getAvailableIODevices(): Promise<AvailableIODevicesType> {
|
||||
async #pollForMediaDevices(): Promise<void> {
|
||||
const newSettings = await this.getMediaDeviceSettings();
|
||||
return this.#maybeUpdateDevices(newSettings);
|
||||
}
|
||||
|
||||
async #getAvailableIODevicesWithPrefetchedDevices(
|
||||
prefetchedMicrophones: Array<AudioDevice> | undefined,
|
||||
prefetchedSpeakers: Array<AudioDevice> | undefined
|
||||
): Promise<AvailableIODevicesType> {
|
||||
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<MediaDeviceSettings> {
|
||||
async getAvailableIODevices(): Promise<AvailableIODevicesType> {
|
||||
return this.#getAvailableIODevicesWithPrefetchedDevices(
|
||||
undefined,
|
||||
undefined
|
||||
);
|
||||
}
|
||||
|
||||
async #getMediaDeviceSettingsWithPrefetchedDevices(
|
||||
prefetchedMicrophones: Array<AudioDevice> | undefined,
|
||||
prefetchedSpeakers: Array<AudioDevice> | undefined
|
||||
): Promise<MediaDeviceSettings> {
|
||||
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<MediaDeviceSettings> {
|
||||
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<AudioDevice>): Promise<void> {
|
||||
const newSettings = await this.#getMediaDeviceSettingsWithPrefetchedDevices(
|
||||
undefined,
|
||||
devices
|
||||
);
|
||||
return this.#maybeUpdateDevices(newSettings);
|
||||
}
|
||||
|
||||
async #handleInputDeviceChanged(devices: Array<AudioDevice>): Promise<void> {
|
||||
const newSettings = await this.#getMediaDeviceSettingsWithPrefetchedDevices(
|
||||
devices,
|
||||
undefined
|
||||
);
|
||||
return this.#maybeUpdateDevices(newSettings);
|
||||
}
|
||||
|
||||
public async updateCallHistoryForAdhocCall(
|
||||
roomId: string,
|
||||
joinState: GroupCallJoinState | null,
|
||||
|
||||
Reference in New Issue
Block a user