Bug 1260745 - Null-check the `friendly_name` field in a `cubeb_device`. r?jesup
They can be null, according to the cubeb API.
MozReview-Commit-ID: FOKG2kTy9NX
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -73,16 +73,17 @@ void AudioInputCubeb::UpdateDeviceList()
// 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_DISABLED &&
+ devices->device[i]->friendly_name &&
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