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 825396 dc1952972a9d104180865901b8ba8ea4ee5dea98
parent 825395 f990ce0881a5ec6c168b998817255cbaee8b583f
child 825397 19596059c23dc4ea86c9315c54fe5ebaef75578c
push id118097
push userpaul@paul.cx
push dateWed, 01 Aug 2018 17:03:19 +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);