summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-02-03 22:02:48 -0800
committerRoxie Linden <roxie@lindenlab.com>2024-02-08 18:35:55 -0800
commit73b00bfe94a6a2a4ea0abc2cf716d835820dfdba (patch)
tree196df21e1794bf7ac2afaa9295bf232a32a98a90 /indra/newview
parentfd077d8a9b5e2a5d3971b4bcae06f5ee39e6c53b (diff)
Handle 'device changed' callback
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llvoicewebrtc.cpp27
-rw-r--r--indra/newview/llvoicewebrtc.h1
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.