summaryrefslogtreecommitdiff
path: root/indra/llwebrtc
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-02-03 22:02:48 -0800
committerRoxie Linden <roxie@lindenlab.com>2024-02-22 23:11:37 -0800
commit8d414e408e096946b0409e8ca9d5011d64f89671 (patch)
tree01c8a02bc19eadccc95254d45b59cfe8083e5c96 /indra/llwebrtc
parent9ac4334ff38a6aec26384fd37c33805105231928 (diff)
Handle 'device changed' callback
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r--indra/llwebrtc/llwebrtc.cpp22
-rw-r--r--indra/llwebrtc/llwebrtc.h9
-rw-r--r--indra/llwebrtc/llwebrtc_impl.h7
3 files changed, 29 insertions, 9 deletions
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 900698aa56..d6eff5e1f2 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -113,6 +113,7 @@ void LLWebRTCImpl::init()
mTuningDeviceModule->SetStereoRecording(true);
mTuningDeviceModule->SetStereoPlayout(true);
mTuningDeviceModule->EnableBuiltInAEC(false);
+ mTuningDeviceModule->SetAudioDeviceSink(this);
updateDevices();
});
@@ -379,31 +380,42 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
void LLWebRTCImpl::updateDevices()
{
- int16_t renderDeviceCount = mTuningDeviceModule->PlayoutDevices();
+ int16_t renderDeviceCount = mTuningDeviceModule->PlayoutDevices();
+ int16_t currentRenderDeviceIndex = mTuningDeviceModule->GetPlayoutDevice();
+
LLWebRTCVoiceDeviceList renderDeviceList;
for (int16_t index = 0; index < renderDeviceCount; index++)
{
char name[webrtc::kAdmMaxDeviceNameSize];
char guid[webrtc::kAdmMaxGuidSize];
mTuningDeviceModule->PlayoutDeviceName(index, name, guid);
- renderDeviceList.emplace_back(name, guid);
+ renderDeviceList.emplace_back(name, guid, index == currentRenderDeviceIndex);
}
- int16_t captureDeviceCount = mTuningDeviceModule->RecordingDevices();
+ int16_t captureDeviceCount = mTuningDeviceModule->RecordingDevices();
+ int16_t currentCaptureDeviceIndex = mTuningDeviceModule->GetRecordingDevice();
+
LLWebRTCVoiceDeviceList captureDeviceList;
for (int16_t index = 0; index < captureDeviceCount; index++)
{
char name[webrtc::kAdmMaxDeviceNameSize];
char guid[webrtc::kAdmMaxGuidSize];
mTuningDeviceModule->RecordingDeviceName(index, name, guid);
- captureDeviceList.emplace_back(name, guid);
+ captureDeviceList.emplace_back(name, guid, index == currentCaptureDeviceIndex);
}
for (auto &observer : mVoiceDevicesObserverList)
{
- observer->OnDevicesChanged(renderDeviceList, captureDeviceList);
+ observer->OnDevicesChanged(renderDeviceList,
+ captureDeviceList);
}
}
+void LLWebRTCImpl::OnDevicesUpdated()
+{
+ updateDevices();
+}
+
+
void LLWebRTCImpl::setTuningMode(bool enable)
{
mWorkerThread->BlockingCall(
diff --git a/indra/llwebrtc/llwebrtc.h b/indra/llwebrtc/llwebrtc.h
index f84e998245..e7effdfbb8 100644
--- a/indra/llwebrtc/llwebrtc.h
+++ b/indra/llwebrtc/llwebrtc.h
@@ -56,11 +56,14 @@ class LLWebRTCVoiceDevice
{
public:
std::string display_name; // friendly value for the user
- std::string id; // internal value for selection
+ std::string id; // internal value for selection
+ bool current; // current device
- LLWebRTCVoiceDevice(const std::string &display_name, const std::string &id) :
+ LLWebRTCVoiceDevice(const std::string &display_name, const std::string &id, bool current) :
display_name(display_name),
- id(id) {};
+ id(id),
+ current(current)
+ {};
};
typedef std::vector<LLWebRTCVoiceDevice> LLWebRTCVoiceDeviceList;
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h
index 884e107527..3ccb6058ad 100644
--- a/indra/llwebrtc/llwebrtc_impl.h
+++ b/indra/llwebrtc/llwebrtc_impl.h
@@ -89,7 +89,7 @@ class LLAudioDeviceObserver : public webrtc::AudioDeviceDataObserver
float mMicrophoneEnergy;
};
-class LLWebRTCImpl : public LLWebRTCDeviceInterface
+class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceSink
{
public:
LLWebRTCImpl() :
@@ -118,6 +118,11 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface
float getPeerAudioLevel() override;
//
+ // AudioDeviceSink
+ //
+ void OnDevicesUpdated() override;
+
+ //
// Helpers
//