diff options
| author | Roxie Linden <roxie@lindenlab.com> | 2024-02-03 22:02:48 -0800 |
|---|---|---|
| committer | Roxie Linden <roxie@lindenlab.com> | 2024-02-22 23:11:37 -0800 |
| commit | 8d414e408e096946b0409e8ca9d5011d64f89671 (patch) | |
| tree | 01c8a02bc19eadccc95254d45b59cfe8083e5c96 /indra/newview | |
| parent | 9ac4334ff38a6aec26384fd37c33805105231928 (diff) | |
Handle 'device changed' callback
Diffstat (limited to 'indra/newview')
| -rw-r--r-- | indra/newview/llvoicewebrtc.cpp | 27 | ||||
| -rw-r--r-- | indra/newview/llvoicewebrtc.h | 1 |
2 files changed, 26 insertions, 2 deletions
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index a3f874aacf..9304ce4740 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -8,7 +8,7 @@ * ne * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; + * License as published by the Free Software Foundation * version 2.1 of the License only. * * This library is distributed in the hope that it will be useful, @@ -689,16 +689,41 @@ void LLWebRTCVoiceClient::setDevicesListUpdated(bool state) void LLWebRTCVoiceClient::OnDevicesChanged(const llwebrtc::LLWebRTCVoiceDeviceList &render_devices, const llwebrtc::LLWebRTCVoiceDeviceList &capture_devices) { + std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); + std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); + clearRenderDevices(); + bool renderDeviceSet = false; for (auto &device : render_devices) { addRenderDevice(LLVoiceDevice(device.display_name, device.id)); + if (device.current && outputDevice == device.id) + { + setRenderDevice(outputDevice); + renderDeviceSet = true; + } + } + if (!renderDeviceSet) + { + setRenderDevice("Default"); } + clearCaptureDevices(); + bool captureDeviceSet = false; for (auto &device : capture_devices) { addCaptureDevice(LLVoiceDevice(device.display_name, device.id)); + if (device.current && inputDevice == device.id) + { + setCaptureDevice(outputDevice); + captureDeviceSet = true; + } } + if (!captureDeviceSet) + { + setCaptureDevice("Default"); + } + setDevicesListUpdated(true); } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index d7d6ca6229..83cb3c7eef 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -102,7 +102,6 @@ public: /// @name Devices //@{ // This returns true when it's safe to bring up the "device settings" dialog in the prefs. - // i.e. when the daemon is running and connected, and the device lists are populated. bool deviceSettingsAvailable() override; bool deviceSettingsUpdated() override; //return if the list has been updated and never fetched, only to be called from the voicepanel. |
