Bug 1434477 - If AudioCallbackDriver::Init() can't get a cubeb context, fall back to system clock driver. r?padenot draft
authorBryce Van Dyk <bvandyk@mozilla.com>
Mon, 19 Mar 2018 14:46:36 -0400
changeset 770328 1baea1fcba118664689e689dc69696b2d73c8ebd
parent 770327 23dc7ef9ef562f20d4f803a07ff9654a832c988f
child 770339 6c14737defcee2b1d63c3f91c444635e757540cc
push id103379
push userbvandyk@mozilla.com
push dateWed, 21 Mar 2018 00:12:14 +0000
reviewerspadenot
bugs1434477
milestone61.0a1
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.");