Bug 1245216: white-list the fake 440Hz audio source used in automation for getUserMedia enumeration r?padenot
--- 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);