Bug 1550695 - Avoid duplicating cubeb_init in both arms of MOZ_CUBEB_REMOTING ifdef. r=achronop a=jcristau
authorMatthew Gregan <kinetik@flim.org>
Tue, 28 May 2019 09:43:08 +0000
changeset 536577 d68ba2d3844c731135e9fbdf750e727fd8412fea
parent 536576 18e5f48ade65db5526283fa0c54e769f1e970549
child 536578 abda154079efcd7fdc78ab5a0ba6e13fc14aa93a
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersachronop, jcristau
bugs1550695
milestone68.0
Bug 1550695 - Avoid duplicating cubeb_init in both arms of MOZ_CUBEB_REMOTING ifdef. r=achronop a=jcristau 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;
 }