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 draft
authorPaul Adenot <paul@paul.cx>
Fri, 22 Jun 2018 11:47:06 +0200
changeset 824656 9cab933a4ba12b7c5f8f92af77a757d1fe92acc1
parent 824655 1ac501f559943478dcbd76f94b4d678cceb792bc
child 824657 ff8e7e4cda229cbd22ac4939db9b0da326a9e508
push id117965
push userpaul@paul.cx
push dateTue, 31 Jul 2018 14:52:35 +0000
reviewerspehrsons
bugs1404977
milestone63.0a1
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
dom/media/webrtc/MediaEngineWebRTC.cpp
--- 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);