Bug 1307754 - Set default device index properly on first enumeration. r=padenot a=jcristau
authorRandell Jesup <rjesup@jesup.org>
Sun, 20 Nov 2016 02:04:21 -0500
changeset 352757 ceda318fb493563f2abbfedd5a318831c6ba1248
parent 352756 0277a89270ffd4de69f2b62d4a4fda1ef9db86a8
child 352758 6a3264ad059fd8def560e753ccc5ee60cd72a724
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot, jcristau
bugs1307754
milestone52.0a2
Bug 1307754 - Set default device index properly on first enumeration. r=padenot a=jcristau MozReview-Commit-ID: B1Sk3W7v5WC
dom/media/webrtc/MediaEngineWebRTC.cpp
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -86,16 +86,17 @@ void AudioInputCubeb::UpdateDeviceList()
       auto j = mDeviceNames->IndexOf(devices->device[i]->device_id);
       if (j != nsTArray<nsCString>::NoIndex) {
         // match! update the mapping
         (*mDeviceIndexes)[j] = i;
       } else {
         // new device, add to the array
         mDeviceIndexes->AppendElement(i);
         mDeviceNames->AppendElement(devices->device[i]->device_id);
+        j = mDeviceIndexes->Length()-1;
       }
       if (devices->device[i]->preferred & CUBEB_DEVICE_PREF_VOICE) {
         // There can be only one... we hope
         NS_ASSERTION(mDefaultDevice == -1, "multiple default cubeb input devices!");
         mDefaultDevice = j;
       }
     }
   }