Bug 1404977 - Part 15 - Invalidate the device cache before re-enumerating devices when the cubeb backend does not support dynamic device collection invalidation. r?pehrsons
Also, clear the array that's been passed in before appending the new devices.
MozReview-Commit-ID: BTnwzyKBrb5
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -391,19 +391,21 @@ CubebDeviceEnumerator::EnumerateAudioInp
if (!context) {
return;
}
MutexAutoLock lock(mMutex);
if (mDevices.IsEmpty() || mManualInvalidation) {
+ mDevices.Clear();
CubebUtils::GetDeviceCollection(mDevices, CubebUtils::Input);
}
+ aOutDevices.Clear();
aOutDevices.AppendElements(mDevices);
}
already_AddRefed<AudioDeviceInfo>
CubebDeviceEnumerator::DeviceInfoFromID(CubebUtils::AudioDeviceID aID)
{
MutexAutoLock lock(mMutex);