Bug 1260745 - Null-check the `friendly_name` field in a `cubeb_device`. r=jesup
authorPaul Adenot <paul@paul.cx>
Wed, 30 Mar 2016 16:47:02 +0200
changeset 330466 efd6926125e25711dcd2dc7d390564652ac86b74
parent 330465 4441e42e5bec17ebb8558b980adb2de087208041
child 330467 f50bbe259eb0971d77f68d77fb93dd6d5b49ac1a
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1260745
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/media/webrtc/MediaEngineWebRTC.cpp
--- a/dom/media/webrtc/MediaEngineWebRTC.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTC.cpp
@@ -74,16 +74,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