author | shindli <shindli@mozilla.com> |
Fri, 23 Mar 2018 04:11:01 +0200 | |
changeset 409575 | 44b07396e0ac0c7f31a3feab50b9b791035fb7da |
parent 409574 | ed217fb39a9232a167a1d5acaa71d73cbbcfea24 |
child 409576 | 0c3cc2c687235cf79735312772b697366337d558 |
push id | 33692 |
push user | nbeleuzu@mozilla.com |
push date | Fri, 23 Mar 2018 09:49:37 +0000 |
treeherder | mozilla-central@9b72102a99b3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 1446233 |
milestone | 61.0a1 |
backs out | ed217fb39a9232a167a1d5acaa71d73cbbcfea24 f5bec009a111cc192a0f6e58e22e7c08850f9222 a71dd6219f8a19bbcc90faabbd4e0682b4daad43 |
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
|
--- a/Cargo.lock +++ b/Cargo.lock @@ -66,17 +66,17 @@ dependencies = [ "serde_derive 1.0.27 (git+https://github.com/gankro/serde?branch=deserialize_from_enums4)", "tokio-core 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "audioipc-client" -version = "0.4.0" +version = "0.3.0" dependencies = [ "audioipc 0.2.2", "cubeb-backend 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -719,17 +719,17 @@ dependencies = [ "nsstring-gtest 0.1.0", "xpcom-gtest 0.1.0", ] [[package]] name = "gkrust-shared" version = "0.1.0" dependencies = [ - "audioipc-client 0.4.0", + "audioipc-client 0.3.0", "audioipc-server 0.2.2", "cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "cubeb-pulse 0.1.1", "cubeb-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_c 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_glue 0.1.0", "geckoservo 0.0.1", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
--- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -24,30 +24,25 @@ #include "nsThreadUtils.h" #include "prdtoa.h" #include <algorithm> #include <stdint.h> #ifdef MOZ_WIDGET_ANDROID #include "GeneratedJNIWrappers.h" #endif -#define AUDIOIPC_POOL_SIZE_DEFAULT 1 -#define AUDIOIPC_STACK_SIZE_DEFAULT (64*1024) - #define PREF_VOLUME_SCALE "media.volume_scale" #define PREF_CUBEB_BACKEND "media.cubeb.backend" #define PREF_CUBEB_LATENCY_PLAYBACK "media.cubeb_latency_playback_ms" #define PREF_CUBEB_LATENCY_MSG "media.cubeb_latency_msg_frames" // Allows to get something non-default for the preferred sample-rate, to allow // troubleshooting in the field and testing. #define PREF_CUBEB_FORCE_SAMPLE_RATE "media.cubeb.force_sample_rate" #define PREF_CUBEB_LOGGING_LEVEL "media.cubeb.logging_level" #define PREF_CUBEB_SANDBOX "media.cubeb.sandbox" -#define PREF_AUDIOIPC_POOL_SIZE "media.audioipc.pool_size" -#define PREF_AUDIOIPC_STACK_SIZE "media.audioipc.stack_size" #define MASK_MONO (1 << AudioConfig::CHANNEL_MONO) #define MASK_MONO_LFE (MASK_MONO | (1 << AudioConfig::CHANNEL_LFE)) #define MASK_STEREO ((1 << AudioConfig::CHANNEL_LEFT) | (1 << AudioConfig::CHANNEL_RIGHT)) #define MASK_STEREO_LFE (MASK_STEREO | (1 << AudioConfig::CHANNEL_LFE)) #define MASK_3F (MASK_STEREO | (1 << AudioConfig::CHANNEL_CENTER)) #define MASK_3F_LFE (MASK_3F | (1 << AudioConfig::CHANNEL_LFE)) #define MASK_2F1 (MASK_STEREO | (1 << AudioConfig::CHANNEL_RCENTER)) @@ -61,29 +56,22 @@ #define MASK_3F3R_LFE (MASK_3F2_LFE | (1 << AudioConfig::CHANNEL_RCENTER)) #define MASK_3F4_LFE (MASK_3F2_LFE | (1 << AudioConfig::CHANNEL_RLS) | (1 << AudioConfig::CHANNEL_RRS)) #if (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID)) || defined(XP_MACOSX) #define MOZ_CUBEB_REMOTING #endif extern "C" { - -struct AudioIpcInitParams { - int mServerConnection; - size_t mPoolSize; - size_t mStackSize; -}; - // These functions are provided by audioipc-server crate extern void* audioipc_server_start(); extern mozilla::ipc::FileDescriptor::PlatformHandleType audioipc_server_new_client(void*); extern void audioipc_server_stop(void*); // These functions are provided by audioipc-client crate -extern int audioipc_client_init(cubeb**, const char*, const AudioIpcInitParams*); +extern int audioipc_client_init(cubeb**, const char*, int); } namespace mozilla { namespace { #ifdef MOZ_CUBEB_REMOTING //////////////////////////////////////////////////////////////////////////////// @@ -140,19 +128,17 @@ uint32_t sCubebMSGLatencyInFrames = 512; // If sCubebForcedSampleRate is zero, PreferredSampleRate will return the // preferred sample-rate for the audio backend in use. Otherwise, it will be // used as the preferred sample-rate. uint32_t sCubebForcedSampleRate = 0; bool sCubebPlaybackLatencyPrefSet = false; bool sCubebMSGLatencyPrefSet = false; bool sAudioStreamInitEverSucceeded = false; #ifdef MOZ_CUBEB_REMOTING -bool sCubebSandbox = false; -size_t sAudioIPCPoolSize; -size_t sAudioIPCStackSize; +bool sCubebSandbox; #endif StaticAutoPtr<char> sBrandName; StaticAutoPtr<char> sCubebBackendName; const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties"; const char* AUDIOSTREAM_BACKEND_ID_STR[] = { "jack", @@ -292,26 +278,16 @@ void PrefChanged(const char* aPref, void sCubebSandbox = Preferences::GetBool(aPref); MOZ_LOG(gCubebLog, LogLevel::Verbose, ("%s: %s", PREF_CUBEB_SANDBOX, sCubebSandbox ? "true" : "false")); if (sCubebSandbox && !sServerHandle && XRE_IsParentProcess()) { MOZ_LOG(gCubebLog, LogLevel::Debug, ("Starting cubeb server...")); StartSoundServer(); } } - else if (strcmp(aPref, PREF_AUDIOIPC_POOL_SIZE) == 0) { - StaticMutexAutoLock lock(sMutex); - sAudioIPCPoolSize = Preferences::GetUint(PREF_AUDIOIPC_POOL_SIZE, - AUDIOIPC_POOL_SIZE_DEFAULT); - } - else if (strcmp(aPref, PREF_AUDIOIPC_STACK_SIZE) == 0) { - StaticMutexAutoLock lock(sMutex); - sAudioIPCStackSize = Preferences::GetUint(PREF_AUDIOIPC_STACK_SIZE, - AUDIOIPC_STACK_SIZE_DEFAULT); - } #endif } bool GetFirstStream() { static bool sFirstStream = true; StaticMutexAutoLock lock(sMutex); @@ -499,27 +475,21 @@ cubeb* GetCubebContextUnlocked() // TODO: Don't use audio IPC when within the same process. MOZ_ASSERT(!sIPCConnection); sIPCConnection = new ipc::FileDescriptor(CreateAudioIPCConnection()); } else { MOZ_DIAGNOSTIC_ASSERT(sIPCConnection); } } - AudioIpcInitParams initParams; - initParams.mPoolSize = sAudioIPCPoolSize; - initParams.mStackSize = sAudioIPCStackSize; - initParams.mServerConnection = sIPCConnection->ClonePlatformHandle().release(); - - 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)); MOZ_LOG(gCubebLog, LogLevel::Info, ("%s: %s", PREF_CUBEB_SANDBOX, sCubebSandbox ? "true" : "false")); int rv = sCubebSandbox - ? audioipc_client_init(&sCubebContext, sBrandName, &initParams) + ? audioipc_client_init(&sCubebContext, sBrandName, + sIPCConnection->ClonePlatformHandle().release()) : cubeb_init(&sCubebContext, sBrandName, sCubebBackendName.get()); 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; @@ -604,18 +574,16 @@ uint32_t GetCubebMSGLatencyInFrames(cube void InitLibrary() { Preferences::RegisterCallbackAndCall(PrefChanged, PREF_VOLUME_SCALE); Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LATENCY_PLAYBACK); Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LATENCY_MSG); Preferences::RegisterCallback(PrefChanged, PREF_CUBEB_FORCE_SAMPLE_RATE); Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_BACKEND); Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_SANDBOX); - Preferences::RegisterCallbackAndCall(PrefChanged, PREF_AUDIOIPC_POOL_SIZE); - Preferences::RegisterCallbackAndCall(PrefChanged, PREF_AUDIOIPC_STACK_SIZE); if (MOZ_LOG_TEST(gCubebLog, LogLevel::Verbose)) { cubeb_set_log_callback(CUBEB_LOG_VERBOSE, CubebLogCallback); } else if (MOZ_LOG_TEST(gCubebLog, LogLevel::Error)) { cubeb_set_log_callback(CUBEB_LOG_NORMAL, CubebLogCallback); } // We don't want to call the callback on startup, because the pref is the // empty string by default ("", which means "logging disabled"). Because the // logging can be enabled via environment variables (MOZ_LOG="module:5"), @@ -630,18 +598,16 @@ void InitLibrary() InitAudioIPCConnection(); } #endif } void ShutdownLibrary() { Preferences::UnregisterCallback(PrefChanged, PREF_VOLUME_SCALE); - Preferences::UnregisterCallback(PrefChanged, PREF_AUDIOIPC_STACK_SIZE); - Preferences::UnregisterCallback(PrefChanged, PREF_AUDIOIPC_POOL_SIZE); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_SANDBOX); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_BACKEND); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_LATENCY_PLAYBACK); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_FORCE_SAMPLE_RATE); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_LATENCY_MSG); Preferences::UnregisterCallback(PrefChanged, PREF_CUBEB_LOGGING_LEVEL); StaticMutexAutoLock lock(sMutex);
--- a/media/audioipc/README_MOZILLA +++ b/media/audioipc/README_MOZILLA @@ -1,8 +1,8 @@ The source from this directory was copied from the audioipc-2 git repository using the update.sh script. The only changes made were those applied by update.sh and the addition of Makefile.in build files for the Mozilla build system. The audioipc-2 git repository is: https://github.com/djg/audioipc-2.git -The git commit ID used was b93386611d7d9689c4f0177a4704f0adc16bc2d1 (2018-03-09 14:45:24 +1000) +The git commit ID used was f6c4829f826950fc059dbf7b33e8aa9e20c447a5 (2018-03-07 20:25:18 +0100)
--- a/media/audioipc/client/Cargo.toml +++ b/media/audioipc/client/Cargo.toml @@ -1,19 +1,19 @@ [package] name = "audioipc-client" -version = "0.4.0" +version = "0.3.0" authors = [ "Matthew Gregan <kinetik@flim.org>", "Dan Glastonbury <dan.glastonbury@gmail.com>" ] description = "Cubeb Backend for talking to remote cubeb server." [dependencies] audioipc = { path="../audioipc" } cubeb-backend = "0.4" foreign-types = "0.3" futures = { version="0.1.18", default-features=false, features=["use_std"] } -futures-cpupool = { version="0.1.8", default-features=false } +futures-cpupool = { version="0.1.5", default-features=false } libc = "0.2" log = "^0.3.6" tokio-core = "0.1" tokio-uds = "0.1.7"
--- a/media/audioipc/client/src/context.rs +++ b/media/audioipc/client/src/context.rs @@ -1,14 +1,14 @@ // Copyright © 2017 Mozilla Foundation // // This program is made available under an ISC-style license. See the // accompanying file LICENSE for details -use {ClientStream, CPUPOOL_INIT_PARAMS, G_SERVER_FD}; +use ClientStream; use assert_not_in_callback; use audioipc::{messages, ClientMessage, ServerMessage}; use audioipc::{core, rpc}; use audioipc::codec::LengthDelimitedCodec; use audioipc::fd_passing::{framed_with_fds, FramedWithFds}; use cubeb_backend::{ffi, ChannelLayout, Context, ContextOps, DeviceCollectionRef, DeviceId, DeviceType, Error, Ops, Result, Stream, StreamParams, StreamParamsRef}; use futures::Future; @@ -64,17 +64,17 @@ impl ClientContext { pub fn cpu_pool(&self) -> CpuPool { self.cpu_pool.clone() } } // TODO: encapsulate connect, etc inside audioipc. fn open_server_stream() -> Result<net::UnixStream> { unsafe { - if let Some(fd) = G_SERVER_FD { + if let Some(fd) = super::G_SERVER_FD { return Ok(net::UnixStream::from_raw_fd(fd)); } Err(Error::default()) } } impl ContextOps for ClientContext { @@ -108,24 +108,19 @@ impl ContextOps for ClientContext { io::ErrorKind::Other, "Failed to open stream and create rpc.", ) }) })); let rpc = t!(rx_rpc.recv()); - let cpupool = CPUPOOL_INIT_PARAMS.with(|p| { - let params = p.replace(None).unwrap(); - futures_cpupool::Builder::new() - .name_prefix("AudioIPC") - .pool_size(params.pool_size) - .stack_size(params.stack_size) - .create() - }); + let cpupool = futures_cpupool::Builder::new() + .name_prefix("AudioIPC") + .create(); let ctx = Box::new(ClientContext { _ops: &CLIENT_OPS as *const _, rpc: rpc, core: core, cpu_pool: cpupool, }); Ok(unsafe { Context::from_ptr(Box::into_raw(ctx) as *mut _) }) @@ -265,17 +260,17 @@ impl ContextOps for ClientContext { } } impl Drop for ClientContext { fn drop(&mut self) { debug!("ClientContext drop..."); let _ = send_recv!(self.rpc(), ClientDisconnect => ClientDisconnected); unsafe { - if G_SERVER_FD.is_some() { + if super::G_SERVER_FD.is_some() { libc::close(super::G_SERVER_FD.take().unwrap()); } } } } impl fmt::Debug for ClientContext { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
--- a/media/audioipc/client/src/lib.rs +++ b/media/audioipc/client/src/lib.rs @@ -21,86 +21,42 @@ mod context; mod stream; use context::ClientContext; use cubeb_backend::{capi, ffi}; use std::os::raw::{c_char, c_int}; use std::os::unix::io::RawFd; use stream::ClientStream; -type InitParamsTls = std::cell::RefCell<Option<CpuPoolInitParams>>; - thread_local!(static IN_CALLBACK: std::cell::RefCell<bool> = std::cell::RefCell::new(false)); -thread_local!(static CPUPOOL_INIT_PARAMS: InitParamsTls = std::cell::RefCell::new(None)); - -#[repr(C)] -#[derive(Clone, Copy, Debug)] -pub struct AudioIpcInitParams { - pub server_connection: c_int, - pub pool_size: usize, - pub stack_size: usize, -} - -#[derive(Clone, Copy, Debug)] -struct CpuPoolInitParams { - pub pool_size: usize, - pub stack_size: usize, -} - -impl CpuPoolInitParams { - pub fn init_with(params: &AudioIpcInitParams) -> Self { - CpuPoolInitParams { - pool_size: params.pool_size, - stack_size: params.stack_size, - } - } -} fn set_in_callback(in_callback: bool) { IN_CALLBACK.with(|b| { assert_eq!(*b.borrow(), !in_callback); *b.borrow_mut() = in_callback; }); } fn assert_not_in_callback() { IN_CALLBACK.with(|b| { assert_eq!(*b.borrow(), false); }); } -fn set_cpupool_init_params<P>(params: P) -where - P: Into<Option<CpuPoolInitParams>>, -{ - CPUPOOL_INIT_PARAMS.with(|p| { - *p.borrow_mut() = params.into(); - }); -} - static mut G_SERVER_FD: Option<RawFd> = None; #[no_mangle] /// Entry point from C code. pub unsafe extern "C" fn audioipc_client_init( c: *mut *mut ffi::cubeb, context_name: *const c_char, - init_params: *const AudioIpcInitParams, + server_connection: c_int, ) -> c_int { - if init_params.is_null() { - return cubeb_backend::ffi::CUBEB_ERROR; - } - - let init_params = &*init_params; - // TODO: Windows portability (for fd). // TODO: Better way to pass extra parameters to Context impl. if G_SERVER_FD.is_some() { panic!("audioipc client's server connection already initialized."); } - if init_params.server_connection >= 0 { - G_SERVER_FD = Some(init_params.server_connection); + if server_connection >= 0 { + G_SERVER_FD = Some(server_connection); } - - let cpupool_init_params = CpuPoolInitParams::init_with(&init_params); - set_cpupool_init_params(cpupool_init_params); capi::capi_init::<ClientContext>(c, context_name) }
--- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -661,21 +661,16 @@ pref("media.decoder.skip-to-next-key-fra // Log level for cubeb, the audio input/output system. Valid values are // "verbose", "normal" and "" (log disabled). pref("media.cubeb.logging_level", ""); // Cubeb sandbox (remoting) control #ifdef XP_LINUX pref("media.cubeb.sandbox", true); -// The cubeb pulse audio backend effectively serializes callbacks so -// only 1 thread is required. -pref("media.audioipc.pool_size", 1); -// 64 kB stack per pool thread. -pref("media.audioipc.stack_size", 65536); #else pref("media.cubeb.sandbox", false); #endif // Set to true to force demux/decode warnings to be treated as errors. pref("media.playback.warnings-as-errors", false); // Weather we allow AMD switchable graphics