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
--- 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.");