Bug 1530715 - P3: Build cubeb-coreaudio-rs in libcubeb. r=kinetik
☠☠ backed out by 744a7f934cfa ☠ ☠
authorChun-Min Chang <chun.m.chang@gmail.com>
Tue, 09 Jul 2019 19:56:58 +0000
changeset 482065 0500179d3bbf79b00e2b25a8cf0d9d74c69923a4
parent 482064 4bed62b601c656cd198a8873f4c180923110a081
child 482066 48719d342b6ff2cd725846b94a5fa6338d1f2694
push id36268
push useraciure@mozilla.com
push dateWed, 10 Jul 2019 15:45:05 +0000
treeherdermozilla-central@255f27d1127e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1530715
milestone70.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 1530715 - P3: Build cubeb-coreaudio-rs in libcubeb. r=kinetik Differential Revision: https://phabricator.services.mozilla.com/D23432
media/libcubeb/src/moz.build
toolkit/library/gtest/rust/Cargo.toml
toolkit/library/rust/Cargo.toml
toolkit/library/rust/gkrust-features.mozbuild
toolkit/library/rust/shared/Cargo.toml
toolkit/library/rust/shared/lib.rs
toolkit/moz.configure
--- a/media/libcubeb/src/moz.build
+++ b/media/libcubeb/src/moz.build
@@ -55,16 +55,18 @@ if CONFIG['OS_TARGET'] == 'Darwin':
         'cubeb_audiounit.cpp',
         'cubeb_resampler.cpp'
     ]
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
         SOURCES += [
             'cubeb_osx_run_loop.c',
         ]
     DEFINES['USE_AUDIOUNIT'] = True
+    if CONFIG['MOZ_AUDIOUNIT_RUST']:
+        DEFINES['USE_AUDIOUNIT_RUST'] = True
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     SOURCES += [
         'cubeb_resampler.cpp',
         'cubeb_wasapi.cpp',
         'cubeb_winmm.c',
     ]
     DEFINES['USE_WINMM'] = True
--- a/toolkit/library/gtest/rust/Cargo.toml
+++ b/toolkit/library/gtest/rust/Cargo.toml
@@ -5,16 +5,17 @@ authors = ["nobody@mozilla.org"]
 license = "MPL-2.0"
 description = "Testing code for libgkrust"
 
 [features]
 bindgen = ["gkrust-shared/bindgen"]
 servo = ["gkrust-shared/servo"]
 quantum_render = ["gkrust-shared/quantum_render"]
 cubeb-remoting = ["gkrust-shared/cubeb-remoting"]
+cubeb_coreaudio_rust = ["gkrust-shared/cubeb_coreaudio_rust"]
 cubeb_pulse_rust = ["gkrust-shared/cubeb_pulse_rust"]
 gecko_debug = ["gkrust-shared/gecko_debug"]
 gecko_refcount_logging = ["gkrust-shared/gecko_refcount_logging"]
 simd-accel = ["gkrust-shared/simd-accel"]
 moz_memory = ["gkrust-shared/moz_memory"]
 moz_places = ["gkrust-shared/moz_places"]
 spidermonkey_rust = ["gkrust-shared/spidermonkey_rust"]
 cranelift_x86 = ["gkrust-shared/cranelift_x86"]
--- a/toolkit/library/rust/Cargo.toml
+++ b/toolkit/library/rust/Cargo.toml
@@ -7,16 +7,17 @@ description = "Rust code for libxul"
 
 [features]
 bindgen = ["gkrust-shared/bindgen"]
 servo = ["gkrust-shared/servo"]
 quantum_render = ["gkrust-shared/quantum_render"]
 webrender_debugger = ["gkrust-shared/webrender_debugger"]
 cubeb-remoting = ["gkrust-shared/cubeb-remoting"]
 cubeb_pulse_rust = ["gkrust-shared/cubeb_pulse_rust"]
+cubeb_coreaudio_rust = ["gkrust-shared/cubeb_coreaudio_rust"]
 gecko_debug = ["gkrust-shared/gecko_debug"]
 gecko_refcount_logging = ["gkrust-shared/gecko_refcount_logging"]
 simd-accel = ["gkrust-shared/simd-accel"]
 moz_memory = ["gkrust-shared/moz_memory"]
 moz_places = ["gkrust-shared/moz_places"]
 spidermonkey_rust = ["gkrust-shared/spidermonkey_rust"]
 cranelift_x86 = ["gkrust-shared/cranelift_x86"]
 cranelift_arm32 = ["gkrust-shared/cranelift_arm32"]
--- a/toolkit/library/rust/gkrust-features.mozbuild
+++ b/toolkit/library/rust/gkrust-features.mozbuild
@@ -14,16 +14,19 @@ if CONFIG['MOZ_DEBUG']:
 
 gkrust_features += ['quantum_render']
 if CONFIG['MOZ_WEBRENDER_DEBUGGER']:
     gkrust_features += ['webrender_debugger']
 
 if CONFIG['MOZ_PULSEAUDIO']:
     gkrust_features += ['cubeb_pulse_rust']
 
+if CONFIG['MOZ_AUDIOUNIT_RUST']:
+    gkrust_features += ['cubeb_coreaudio_rust']
+
 if CONFIG['MOZ_RUST_SIMD']:
     gkrust_features += ['simd-accel']
 
 # This feature is not yet supported on all platforms, and this check needs to
 # match MOZ_CUBEB_REMOTING in CubebUtils.cpp.
 if (CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android') or CONFIG['OS_ARCH'] == 'Darwin' or (CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['CPU_ARCH'] != 'aarch64'):
     gkrust_features += ['cubeb-remoting']
 
--- a/toolkit/library/rust/shared/Cargo.toml
+++ b/toolkit/library/rust/shared/Cargo.toml
@@ -13,16 +13,17 @@ mp4parse_capi = { path = "../../../../me
 nserror = { path = "../../../../xpcom/rust/nserror" }
 nsstring = { path = "../../../../xpcom/rust/nsstring" }
 netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
 xpcom = { path = "../../../../xpcom/rust/xpcom" }
 prefs_parser = { path = "../../../../modules/libpref/parser" }
 profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true }
 mozurl = { path = "../../../../netwerk/base/mozurl" }
 webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true }
+cubeb-coreaudio = { path = "../../../../media/libcubeb/cubeb-coreaudio-rs", optional = true }
 cubeb-pulse = { path = "../../../../media/libcubeb/cubeb-pulse-rs", optional = true, features=["pulse-dlopen"] }
 cubeb-sys = { version = "0.5.0", optional = true, features=["gecko-in-tree"] }
 encoding_c = "0.9.0"
 encoding_glue = { path = "../../../../intl/encoding_glue" }
 audioipc-client = { path = "../../../../media/audioipc/client", optional = true }
 audioipc-server = { path = "../../../../media/audioipc/server", optional = true }
 authenticator = "0.2.6"
 gkrust_utils = { path = "../../../../xpcom/rust/gkrust_utils" }
@@ -46,16 +47,17 @@ rustc_version = "0.2"
 
 [features]
 default = []
 bindgen = ["geckoservo/bindgen"]
 servo = ["geckoservo"]
 quantum_render = ["webrender_bindings"]
 webrender_debugger = ["webrender_bindings/webrender_debugger"]
 cubeb-remoting = ["cubeb-sys", "audioipc-client", "audioipc-server"]
+cubeb_coreaudio_rust = ["cubeb-sys", "cubeb-coreaudio"]
 cubeb_pulse_rust = ["cubeb-sys", "cubeb-pulse"]
 gecko_debug = ["geckoservo/gecko_debug", "nsstring/gecko_debug"]
 gecko_refcount_logging = ["geckoservo/gecko_refcount_logging"]
 simd-accel = ["encoding_c/simd-accel", "encoding_glue/simd-accel"]
 moz_memory = ["mp4parse_capi/mp4parse_fallible"]
 moz_places = ["bookmark_sync"]
 spidermonkey_rust = ["jsrust_shared"]
 cranelift_x86 = ["jsrust_shared/cranelift_x86"]
--- a/toolkit/library/rust/shared/lib.rs
+++ b/toolkit/library/rust/shared/lib.rs
@@ -14,16 +14,18 @@ extern crate nserror;
 extern crate xpcom;
 extern crate netwerk_helper;
 extern crate prefs_parser;
 #[cfg(feature = "gecko_profiler")]
 extern crate profiler_helper;
 extern crate mozurl;
 #[cfg(feature = "quantum_render")]
 extern crate webrender_bindings;
+#[cfg(feature = "cubeb_coreaudio_rust")]
+extern crate cubeb_coreaudio;
 #[cfg(feature = "cubeb_pulse_rust")]
 extern crate cubeb_pulse;
 extern crate encoding_c;
 extern crate encoding_glue;
 #[cfg(feature = "cubeb-remoting")]
 extern crate audioipc_client;
 #[cfg(feature = "cubeb-remoting")]
 extern crate audioipc_server;
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -148,16 +148,25 @@ def pulseaudio_default(target):
 option('--enable-pulseaudio', env='MOZ_PULSEAUDIO', default=pulseaudio_default,
        help='{Enable|Disable} PulseAudio audio backend.')
 
 pulseaudio = pkg_check_modules('MOZ_PULSEAUDIO', 'libpulse', when='--enable-pulseaudio')
 
 set_config('MOZ_PULSEAUDIO', depends_if(pulseaudio)(lambda _: True))
 set_define('MOZ_PULSEAUDIO', depends_if(pulseaudio)(lambda _: True))
 
+# AudioUnit cubeb Rust backend
+# ==============================================================
+@depends(target)
+def enable_audiounit_rust(target):
+    return target.os == 'OSX' and target.kernel == 'Darwin'
+
+set_config('MOZ_AUDIOUNIT_RUST', True, when=enable_audiounit_rust)
+set_define('MOZ_AUDIOUNIT_RUST', True, when=enable_audiounit_rust)
+
 # Javascript engine
 # ==============================================================
 include('../js/moz.configure')
 
 
 # NodeJS
 # ==============================================================
 include('../build/moz.configure/node.configure')