Bug 1245216: white-list the fake 440Hz audio source used in automation for getUserMedia enumeration r?padenot draft
authorRandell Jesup <rjesup@jesup.org>
Thu, 04 Feb 2016 12:40:11 -0500
changeset 328918 b2a56a553cf70301d21127c8b9a83d939a739fa7
parent 328917 0ef2d242d4aa82ca79286175056c1d69898eb713
child 328919 12d3ad1f9f899a7548dbe3ff1de47ccefa80632f
push id10433
push userrjesup@wgate.com
push dateThu, 04 Feb 2016 17:45:17 +0000
reviewerspadenot
bugs1245216
milestone47.0a1
Bug 1245216: white-list the fake 440Hz audio source used in automation for getUserMedia enumeration r?padenot
dom/media/webrtc/MediaEngineWebRTC.h
--- a/dom/media/webrtc/MediaEngineWebRTC.h
+++ b/dom/media/webrtc/MediaEngineWebRTC.h
@@ -265,20 +265,24 @@ private:
     for (auto& device_index : (*mDeviceIndexes)) {
       device_index = -1; // unmapped
     }
     // We keep all the device names, but wipe the mappings and rebuild them
 
     // Calculate translation from existing mDevices to new devices. Note we
     // never end up with less devices than before, since people have
     // stashed indexes.
+    // For some reason the "fake" device for automation is marked as DISABLED,
+    // so white-list it.
     for (uint32_t i = 0; i < devices->count; i++) {
       if (devices->device[i]->type == CUBEB_DEVICE_TYPE_INPUT && // paranoia
           (devices->device[i]->state == CUBEB_DEVICE_STATE_ENABLED ||
-           devices->device[i]->state == CUBEB_DEVICE_STATE_UNPLUGGED))
+           devices->device[i]->state == CUBEB_DEVICE_STATE_UNPLUGGED ||
+           (devices->device[i]->state == CUBEB_DEVICE_STATE_DISABLED &&
+            strcmp(devices->device[i]->friendly_name, "Sine source at 440 Hz") == 0)))
       {
         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);