Commit 1e11a69a authored by Butkovits Atila's avatar Butkovits Atila
Browse files

Backed out changeset 634412ce2943 (bug 1724141) for causing failures at...

Backed out changeset 634412ce2943 (bug 1724141) for causing failures at Mutex_posix.cpp. CLOSED TREE
parent 1213e1bc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ rev = "8ae48c16b637d6d9a841cf4d01de06c16b1318b0"
[source."https://github.com/mozilla/audioipc-2"]
git = "https://github.com/mozilla/audioipc-2"
replace-with = "vendored-sources"
rev = "8bb1a227fbaa5677458bcd876162b65307df38c2"
rev = "7537bfadad2e981577eb75e4f13662fc517e1a09"

[source."https://github.com/mozilla/application-services"]
git = "https://github.com/mozilla/application-services"
+3 −3
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ dependencies = [
[[package]]
name = "audioipc"
version = "0.2.5"
source = "git+https://github.com/mozilla/audioipc-2?rev=8bb1a227fbaa5677458bcd876162b65307df38c2#8bb1a227fbaa5677458bcd876162b65307df38c2"
source = "git+https://github.com/mozilla/audioipc-2?rev=7537bfadad2e981577eb75e4f13662fc517e1a09#7537bfadad2e981577eb75e4f13662fc517e1a09"
dependencies = [
 "ashmem",
 "audio_thread_priority",
@@ -198,7 +198,7 @@ dependencies = [
[[package]]
name = "audioipc-client"
version = "0.4.0"
source = "git+https://github.com/mozilla/audioipc-2?rev=8bb1a227fbaa5677458bcd876162b65307df38c2#8bb1a227fbaa5677458bcd876162b65307df38c2"
source = "git+https://github.com/mozilla/audioipc-2?rev=7537bfadad2e981577eb75e4f13662fc517e1a09#7537bfadad2e981577eb75e4f13662fc517e1a09"
dependencies = [
 "audio_thread_priority",
 "audioipc",
@@ -212,7 +212,7 @@ dependencies = [
[[package]]
name = "audioipc-server"
version = "0.2.3"
source = "git+https://github.com/mozilla/audioipc-2?rev=8bb1a227fbaa5677458bcd876162b65307df38c2#8bb1a227fbaa5677458bcd876162b65307df38c2"
source = "git+https://github.com/mozilla/audioipc-2?rev=7537bfadad2e981577eb75e4f13662fc517e1a09#7537bfadad2e981577eb75e4f13662fc517e1a09"
dependencies = [
 "audio_thread_priority",
 "audioipc",
+6 −23
Original line number Diff line number Diff line
@@ -43,8 +43,6 @@

#define AUDIOIPC_POOL_SIZE_DEFAULT 1
#define AUDIOIPC_STACK_SIZE_DEFAULT (64 * 4096)
// See also: https://github.com/mozilla/audioipc-2/issues/124
#define AUDIOIPC_SHM_AREA_SIZE_DEFAULT (512 * 4096)

#define PREF_VOLUME_SCALE "media.volume_scale"
#define PREF_CUBEB_BACKEND "media.cubeb.backend"
@@ -61,7 +59,6 @@
#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 PREF_AUDIOIPC_SHM_AREA_SIZE "media.audioipc.shm_area_size"

#if (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID)) || \
    defined(XP_MACOSX) || (defined(XP_WIN) && !defined(_ARM64_))
@@ -111,7 +108,6 @@ bool sRouteOutputAsVoice = false;
bool sCubebSandbox = false;
size_t sAudioIPCPoolSize;
size_t sAudioIPCStackSize;
size_t sAudioIPCShmAreaSize;
#endif
StaticAutoPtr<char> sBrandName;
StaticAutoPtr<char> sCubebBackendName;
@@ -273,10 +269,6 @@ void PrefChanged(const char* aPref, void* aClosure) {
    StaticMutexAutoLock lock(sMutex);
    sAudioIPCStackSize = Preferences::GetUint(PREF_AUDIOIPC_STACK_SIZE,
                                              AUDIOIPC_STACK_SIZE_DEFAULT);
  } else if (strcmp(aPref, PREF_AUDIOIPC_SHM_AREA_SIZE) == 0) {
    StaticMutexAutoLock lock(sMutex);
    sAudioIPCShmAreaSize = Preferences::GetUint(PREF_AUDIOIPC_SHM_AREA_SIZE,
                                                AUDIOIPC_SHM_AREA_SIZE_DEFAULT);
  }
#endif
  else if (strcmp(aPref, PREF_CUBEB_OUTPUT_VOICE_ROUTING) == 0) {
@@ -417,7 +409,6 @@ void InitAudioIPCConnection() {

ipc::FileDescriptor CreateAudioIPCConnection() {
#ifdef MOZ_CUBEB_REMOTING
  StaticMutexAutoLock lock(sMutex);
  MOZ_ASSERT(sCubebSandbox && XRE_IsParentProcess());
  if (!sServerHandle) {
    MOZ_LOG(gCubebLog, LogLevel::Debug, ("Starting cubeb server..."));
@@ -426,11 +417,9 @@ ipc::FileDescriptor CreateAudioIPCConnection() {
      return ipc::FileDescriptor();
    }
  }
  MOZ_LOG(gCubebLog, LogLevel::Debug,
          ("%s: %d", PREF_AUDIOIPC_SHM_AREA_SIZE, (int)sAudioIPCShmAreaSize));
  MOZ_ASSERT(sServerHandle);
  ipc::FileDescriptor::PlatformHandleType rawFD =
      audioipc::audioipc_server_new_client(sServerHandle, sAudioIPCShmAreaSize);
      audioipc::audioipc_server_new_client(sServerHandle);
  ipc::FileDescriptor fd(rawFD);
  if (!fd.IsValid()) {
    MOZ_LOG(gCubebLog, LogLevel::Error, ("audioipc_server_new_client failed"));
@@ -593,17 +582,11 @@ uint32_t GetCubebMTGLatencyInFrames(cubeb_stream_params* params) {
}

static const char* gInitCallbackPrefs[] = {
    PREF_VOLUME_SCALE,
    PREF_CUBEB_OUTPUT_DEVICE,
    PREF_CUBEB_LATENCY_PLAYBACK,
    PREF_CUBEB_LATENCY_MTG,
    PREF_CUBEB_BACKEND,
    PREF_CUBEB_FORCE_NULL_CONTEXT,
    PREF_CUBEB_SANDBOX,
    PREF_AUDIOIPC_POOL_SIZE,
    PREF_AUDIOIPC_STACK_SIZE,
    PREF_AUDIOIPC_SHM_AREA_SIZE,
    nullptr,
    PREF_VOLUME_SCALE,           PREF_CUBEB_OUTPUT_DEVICE,
    PREF_CUBEB_LATENCY_PLAYBACK, PREF_CUBEB_LATENCY_MTG,
    PREF_CUBEB_BACKEND,          PREF_CUBEB_FORCE_NULL_CONTEXT,
    PREF_CUBEB_SANDBOX,          PREF_AUDIOIPC_POOL_SIZE,
    PREF_AUDIOIPC_STACK_SIZE,    nullptr,
};
static const char* gCallbackPrefs[] = {
    PREF_CUBEB_FORCE_SAMPLE_RATE,
+1 −1
Original line number Diff line number Diff line
{"files":{"Cargo.toml":"4020e8c4119327dac49b47391c902eb69bb927c9e7d05f5882ad9e84cff4ec5e","cbindgen.toml":"bd89c5a9f52395b1c703ff04d1c0019dc3c92b691d571ae503c4b85753a44a39","src/context.rs":"89e2929aa2ba4bddcec6dd4a4511f528c681b7717adbaa7b7df4378c8e3c4d1c","src/lib.rs":"7755001c8caf6899ca5ed00a517d7bf1b6425fe17157a97037dae619af567fc9","src/send_recv.rs":"450bdb1d8a346634c0237f2081b424d11e2c19ad81670009303f8a03b3bfb196","src/stream.rs":"1fb24d5cf51305408068eebee0e367b4f9786f27665c7dba47128defdfadbf5c"},"package":null}
 No newline at end of file
{"files":{"Cargo.toml":"4020e8c4119327dac49b47391c902eb69bb927c9e7d05f5882ad9e84cff4ec5e","cbindgen.toml":"bd89c5a9f52395b1c703ff04d1c0019dc3c92b691d571ae503c4b85753a44a39","src/context.rs":"7388ee487bc25bbdf5cc6475dfa78674bdd9f49c92968c1b0a8047cdd023476c","src/lib.rs":"7755001c8caf6899ca5ed00a517d7bf1b6425fe17157a97037dae619af567fc9","src/send_recv.rs":"450bdb1d8a346634c0237f2081b424d11e2c19ad81670009303f8a03b3bfb196","src/stream.rs":"a7b32be48f67ef6b7fbcf61b25e02cab1e961ef3146c3ace2f16ced9dab2953e"},"package":null}
 No newline at end of file
+14 −11
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ use audio_thread_priority::get_current_thread_info;
#[cfg(not(target_os = "linux"))]
use audio_thread_priority::promote_current_thread_to_real_time;
use audioipc::codec::LengthDelimitedCodec;
use audioipc::framing::{framed, Framed};
use audioipc::frame::{framed, Framed};
use audioipc::platformhandle_passing::{framed_with_platformhandles, FramedWithPlatformHandles};
use audioipc::{core, rpc};
use audioipc::{
    messages, messages::DeviceCollectionReq, messages::DeviceCollectionResp, ClientMessage,
@@ -37,8 +38,10 @@ struct CubebClient;
impl rpc::Client for CubebClient {
    type Request = ServerMessage;
    type Response = ClientMessage;
    type Transport =
        Framed<audioipc::AsyncMessageStream, LengthDelimitedCodec<Self::Request, Self::Response>>;
    type Transport = FramedWithPlatformHandles<
        audioipc::AsyncMessageStream,
        LengthDelimitedCodec<Self::Request, Self::Response>,
    >;
}

pub const CLIENT_OPS: Ops = capi_new!(ClientContext, ClientStream);
@@ -187,7 +190,7 @@ impl ContextOps for ClientContext {
            stream: audioipc::AsyncMessageStream,
            tx_rpc: &mpsc::Sender<rpc::ClientProxy<ServerMessage, ClientMessage>>,
        ) {
            let transport = framed(stream, Default::default());
            let transport = framed_with_platformhandles(stream, Default::default());
            let rpc = rpc::bind_client::<CubebClient>(transport);
            // If send fails then the rx end has closed
            // which is unlikely here.
@@ -203,7 +206,7 @@ impl ContextOps for ClientContext {
        let thread_destroy_callback = params.thread_destroy_callback;

        let server_stream =
            unsafe { audioipc::MessageStream::from_raw_handle(params.server_connection) };
            unsafe { audioipc::MessageStream::from_raw_fd(params.server_connection) };

        let core = core::spawn_thread(
            "AudioIPC Client RPC",
@@ -365,15 +368,15 @@ impl ContextOps for ClientContext {
        assert_not_in_callback();

        if !self.device_collection_rpc {
            let mut fd = send_recv!(self.rpc(),
            let fds = send_recv!(self.rpc(),
                                 ContextSetupDeviceCollectionCallback =>
                                 ContextSetupDeviceCollectionCallback())?;

            let stream = unsafe {
                audioipc::MessageStream::from_raw_handle(
                    fd.platform_handle.take_handle().into_raw(),
                )
            };
            // TODO: The lowest comms layer expects exactly 3 PlatformHandles, but we only
            // need one here.  The server sent two dummy valid handles, ignore those (closed on drop)
            // and use the one we need.
            let stream =
                unsafe { audioipc::MessageStream::from_raw_fd(fds.platform_handles[0].into_raw()) };

            let server = DeviceCollectionServer {
                input_device_callback: self.input_device_callback.clone(),
Loading