Bug 1434477 - If AudioCallbackDriver::Init() can't get a cubeb context, fall back to system clock driver. r=padenot
authorBryce Van Dyk <bvandyk@mozilla.com>
Mon, 19 Mar 2018 14:46:36 -0400
changeset 462747 249d42dff1b530ad155cdbf4e789d1152069633a
parent 462746 0018a815422dab6915f2f94c725c9efc1492e07f
child 462748 d3df709eb18341e5b073c921bc2e45ad09d65328
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspadenot
bugs1434477
milestone61.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 1434477 - If AudioCallbackDriver::Init() can't get a cubeb context, fall back to system clock driver. r=padenot Change AudioCallbackDriver::Init() to fallback to a system clock driver if a cubeb context can not be obtained. This should make driver init more robust in cases where cubeb init fails and then CubebUtils::GetCubebContext() returns no context. MozReview-Commit-ID: IlFPytYacoI
dom/media/GraphDriver.cpp
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -588,20 +588,23 @@ bool IsMacbookOrMacbookAir()
 }
 
 bool
 AudioCallbackDriver::Init()
 {
   cubeb* cubebContext = CubebUtils::GetCubebContext();
   if (!cubebContext) {
     NS_WARNING("Could not get cubeb context.");
+    LOG(LogLevel::Warning, ("%s: Could not get cubeb context", __func__));
     if (!mFromFallback) {
       CubebUtils::ReportCubebStreamInitFailure(true);
     }
-    return false;
+    MonitorAutoLock lock(GraphImpl()->GetMonitor());
+    FallbackToSystemClockDriver();
+    return true;
   }
 
   cubeb_stream_params output;
   cubeb_stream_params input;
   bool firstStream = CubebUtils::GetFirstStream();
 
   MOZ_ASSERT(!NS_IsMainThread(),
       "This is blocking and should never run on the main thread.");