Bug 1443612 - Pre-start cubeb before content sandboxing if not remoting audio. r=kinetik
authorJed Davis <jld@mozilla.com>
Tue, 06 Mar 2018 13:01:35 -0700
changeset 461823 94db8d320385886ad9a96e3648bd935f64582b49
parent 461822 363ed8b83c214b6366441166b14d01ca962d7d61
child 461824 141a3103a248206af8178cdac0e5c90cb4f7efec
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1443612
milestone60.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 1443612 - Pre-start cubeb before content sandboxing if not remoting audio. r=kinetik MozReview-Commit-ID: HBtBH5gCKR4
dom/ipc/ContentChild.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -89,16 +89,17 @@
 
 #if defined(MOZ_CONTENT_SANDBOX)
 #include "mozilla/SandboxSettings.h"
 #if defined(XP_WIN)
 #include "mozilla/sandboxTarget.h"
 #elif defined(XP_LINUX)
 #include "mozilla/Sandbox.h"
 #include "mozilla/SandboxInfo.h"
+#include "CubebUtils.h"
 #elif defined(XP_MACOSX)
 #include "mozilla/Sandbox.h"
 #endif
 #endif
 
 #include "mozilla/Unused.h"
 
 #include "mozInlineSpellChecker.h"
@@ -1666,16 +1667,21 @@ ContentChild::RecvSetProcessSandbox(cons
   // We may want to move the sandbox initialization somewhere else
   // at some point; see bug 880808.
 #if defined(MOZ_CONTENT_SANDBOX)
   bool sandboxEnabled = true;
 #if defined(XP_LINUX)
   // On Linux, we have to support systems that can't use any sandboxing.
   if (!SandboxInfo::Get().CanSandboxContent()) {
     sandboxEnabled = false;
+  } else {
+    // Pre-start audio before sandboxing; see bug 1443612.
+    if (!Preferences::GetBool("media.cubeb.sandbox")) {
+      Unused << CubebUtils::GetCubebContext();
+    }
   }
 
   if (sandboxEnabled) {
     sandboxEnabled =
       SetContentProcessSandbox(ContentProcessSandboxParams::ForThisProcess(aBroker));
   }
 #elif defined(XP_WIN)
   mozilla::SandboxTarget::Instance()->StartSandbox();