Bug 1550695 - Avoid duplicating cubeb_init in both arms of MOZ_CUBEB_REMOTING ifdef. r=achronop
authorMatthew Gregan <kinetik@flim.org>
Tue, 28 May 2019 09:43:08 +0000
changeset 475973 4a88deceba11c2dae458a4130e2ed9f0e7c81dd8
parent 475972 d47b2d152a7d2ab3b8a13ac2e96147d9fdb084be
child 475974 546170ac7ca95ecacf73efeef9c1f53bb4b2fefc
push id36080
push usernerli@mozilla.com
push dateWed, 29 May 2019 09:48:47 +0000
treeherdermozilla-central@d78adc84bde8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersachronop
bugs1550695
milestone69.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 1550695 - Avoid duplicating cubeb_init in both arms of MOZ_CUBEB_REMOTING ifdef. r=achronop Differential Revision: https://phabricator.services.mozilla.com/D32654
dom/media/CubebUtils.cpp
--- a/dom/media/CubebUtils.cpp
+++ b/dom/media/CubebUtils.cpp
@@ -455,21 +455,21 @@ cubeb* GetCubebContextUnlocked() {
   if (!sBrandName && NS_IsMainThread()) {
     InitBrandName();
   } else {
     NS_WARNING_ASSERTION(
         sBrandName,
         "Did not initialize sbrandName, and not on the main thread?");
   }
 
+  int rv = CUBEB_ERROR;
 #ifdef MOZ_CUBEB_REMOTING
   MOZ_LOG(gCubebLog, LogLevel::Info,
           ("%s: %s", PREF_CUBEB_SANDBOX, sCubebSandbox ? "true" : "false"));
 
-  int rv = CUBEB_OK;
   if (sCubebSandbox) {
     if (XRE_IsParentProcess()) {
       // TODO: Don't use audio IPC when within the same process.
       MOZ_ASSERT(!sIPCConnection);
       sIPCConnection = new ipc::FileDescriptor(CreateAudioIPCConnection());
     } else {
       MOZ_DIAGNOSTIC_ASSERT(sIPCConnection);
     }
@@ -485,21 +485,21 @@ cubeb* GetCubebContextUnlocked() {
 
     MOZ_LOG(gCubebLog, LogLevel::Debug,
             ("%s: %d", PREF_AUDIOIPC_POOL_SIZE, (int)initParams.mPoolSize));
     MOZ_LOG(gCubebLog, LogLevel::Debug,
             ("%s: %d", PREF_AUDIOIPC_STACK_SIZE, (int)initParams.mStackSize));
 
     rv = audioipc_client_init(&sCubebContext, sBrandName, &initParams);
   } else {
+#endif  // MOZ_CUBEB_REMOTING
     rv = cubeb_init(&sCubebContext, sBrandName, sCubebBackendName.get());
+#ifdef MOZ_CUBEB_REMOTING
   }
   sIPCConnection = nullptr;
-#else   // !MOZ_CUBEB_REMOTING
-  int rv = cubeb_init(&sCubebContext, sBrandName, sCubebBackendName.get());
 #endif  // MOZ_CUBEB_REMOTING
   NS_WARNING_ASSERTION(rv == CUBEB_OK, "Could not get a cubeb context.");
   sCubebState =
       (rv == CUBEB_OK) ? CubebState::Initialized : CubebState::Uninitialized;
 
   return sCubebContext;
 }