Bug 1589931 - P1: Only check non-null current output device. r=padenot
authorChun-Min Chang <chun.m.chang@gmail.com>
Thu, 14 Nov 2019 21:00:34 +0000
changeset 502076 51cd57a31ea775eeb8605c160cb363512ab6cd2a
parent 502075 4466d109fc5183c6a9a4df40b23d16003c47c463
child 502077 e6727b7a53916137d8f9988ab70d9e26ed72561b
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1589931
milestone72.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 1589931 - P1: Only check non-null current output device. r=padenot Differential Revision: https://phabricator.services.mozilla.com/D52750
dom/media/GraphDriver.cpp
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -1005,30 +1005,31 @@ void AudioCallbackDriver::MixerCallback(
 
   DebugOnly<uint32_t> written = mScratchBuffer.Fill(
       aMixedBuffer + toWrite * aChannels, aFrames - toWrite);
   NS_WARNING_ASSERTION(written == aFrames - toWrite, "Dropping frames.");
 };
 
 void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive) {
 #ifdef XP_MACOSX
-  cubeb_device* out;
+  cubeb_device* out = nullptr;
   int rv;
   char name[128];
   size_t length = sizeof(name);
 
   rv = sysctlbyname("hw.model", name, &length, NULL, 0);
   if (rv) {
     return;
   }
 
   if (!strncmp(name, "MacBookPro", 10)) {
     if (cubeb_stream_get_current_device(mAudioStream, &out) == CUBEB_OK) {
+      MOZ_ASSERT(out);
       // Check if we are currently outputing sound on external speakers.
-      if (!strcmp(out->output_name, "ispk")) {
+      if (out->output_name && !strcmp(out->output_name, "ispk")) {
         // Pan everything to the right speaker.
         LOG(LogLevel::Debug, ("Using the built-in speakers, with%s audio input",
                               aMicrophoneActive ? "" : "out"));
         mNeedsPanning = aMicrophoneActive;
       } else {
         LOG(LogLevel::Debug, ("Using an external output device"));
         mNeedsPanning = false;
       }