Bug 1730499 - Backout most of 1687070 from release. r=#cubeb-reviewers a=RyanVM
Differential Revision:
https://phabricator.services.mozilla.com/D126199
--- a/.cargo/config.in
+++ b/.cargo/config.in
@@ -25,17 +25,17 @@ rev = "c6ba5afd856c158d9cfc1a447165fcfaa
[source."https://github.com/mozilla/l10nregistry-rs"]
git = "https://github.com/mozilla/l10nregistry-rs"
replace-with = "vendored-sources"
rev = "a69df9836b1ef536727195209013b9ad6b132618"
[source."https://github.com/mozilla/cubeb-pulse-rs"]
git = "https://github.com/mozilla/cubeb-pulse-rs"
replace-with = "vendored-sources"
-rev = "3ad5978575f501ab10b1753626f176f1bba3f584"
+rev = "0d168cc5be8865b21694b1b0c5a1c810de104e46"
[source."https://github.com/mozilla/cubeb-coreaudio-rs"]
git = "https://github.com/mozilla/cubeb-coreaudio-rs"
replace-with = "vendored-sources"
rev = "4ee3b283182926f9a8bb31d603219ff2db70d2fd"
[source."https://github.com/mozilla/audioipc-2"]
git = "https://github.com/mozilla/audioipc-2"
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1022,17 +1022,17 @@ dependencies = [
"mach",
"ringbuf",
"triple_buffer",
]
[[package]]
name = "cubeb-pulse"
version = "0.3.0"
-source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=3ad5978575f501ab10b1753626f176f1bba3f584#3ad5978575f501ab10b1753626f176f1bba3f584"
+source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=0d168cc5be8865b21694b1b0c5a1c810de104e46#0d168cc5be8865b21694b1b0c5a1c810de104e46"
dependencies = [
"cubeb-backend",
"pulse",
"pulse-ffi",
"ringbuf",
"semver",
]
@@ -4016,26 +4016,26 @@ dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pulse"
version = "0.3.0"
-source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=3ad5978575f501ab10b1753626f176f1bba3f584#3ad5978575f501ab10b1753626f176f1bba3f584"
+source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=0d168cc5be8865b21694b1b0c5a1c810de104e46#0d168cc5be8865b21694b1b0c5a1c810de104e46"
dependencies = [
"bitflags",
"pulse-ffi",
]
[[package]]
name = "pulse-ffi"
version = "0.1.0"
-source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=3ad5978575f501ab10b1753626f176f1bba3f584#3ad5978575f501ab10b1753626f176f1bba3f584"
+source = "git+https://github.com/mozilla/cubeb-pulse-rs?rev=0d168cc5be8865b21694b1b0c5a1c810de104e46#0d168cc5be8865b21694b1b0c5a1c810de104e46"
dependencies = [
"libc",
]
[[package]]
name = "qcms"
version = "0.2.0"
dependencies = [
--- a/third_party/rust/cubeb-pulse/.cargo-checksum.json
+++ b/third_party/rust/cubeb-pulse/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"95d0d2542c04f0c932f58591b92c3051db5c95657bf5f24b6a6110f7b667568d","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"56e90cb82ec36ead07e551a28fc2455fa658fa8308c3d73f8d856d85bfcd2122","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"8969b300850b56ace07abe570940e2099774bf0bf20325be1d3ec0f5f408c8ce","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"d5da05348bf1a7f65c85b14372964a49dc4849f0aee96c75e2c18b51fb03fcaf","src/backend/stream.rs":"deac28f4840dbeeb195deff8734d594e53fbca3b65545a54613e9e6fa22d7dfc","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
\ No newline at end of file
+{"files":{".editorconfig":"bf047bd1da10cabb99eea666d1e57c321eba4716dccb3e4ed0e2c5fe3ca53858",".github/workflows/build.yml":"95d0d2542c04f0c932f58591b92c3051db5c95657bf5f24b6a6110f7b667568d","AUTHORS":"0e0ac930a68ce2f6b876126b195add177f0d3886facb9260f4d9b69f1988f0cc","Cargo.toml":"56e90cb82ec36ead07e551a28fc2455fa658fa8308c3d73f8d856d85bfcd2122","LICENSE":"44c6b5ae5ec3fe2fbc608b00e6f4896f4d2d5c7e525fcbaa3eaa3cf2f3d5a983","README.md":"0079450bb4b013bac065ed1750851e461a3710ebad1f323817da1cb82db0bc4f","src/backend/context.rs":"8969b300850b56ace07abe570940e2099774bf0bf20325be1d3ec0f5f408c8ce","src/backend/cork_state.rs":"4a0f1afc7d9f333dac89218cc56d7d32fbffb487cd48c1c9a4e03d79cb3b5e28","src/backend/intern.rs":"11ca424e4eb77f8eb9fd5a6717d1e791facf9743156a8534f0016fcf64d57b0f","src/backend/mod.rs":"d5da05348bf1a7f65c85b14372964a49dc4849f0aee96c75e2c18b51fb03fcaf","src/backend/stream.rs":"29f78de5fbce1aa039dabe7b98d697244e17c34689a6c7d2ec29ed9626fa9466","src/capi.rs":"fa0fa020f0d0efe55aa0fc3596405e8407bbe2cbe6c7a558345304e6da87994e","src/lib.rs":"b41bbdc562cbfb130ed7c1e53fe69944774f515705341d8ce48a2f82c8c0c2c5"},"package":null}
\ No newline at end of file
--- a/third_party/rust/cubeb-pulse/src/backend/stream.rs
+++ b/third_party/rust/cubeb-pulse/src/backend/stream.rs
@@ -431,17 +431,17 @@ impl<'ctx> PulseStream<'ctx> {
s.set_state_callback(check_error, stm.as_mut() as *mut _ as *mut _);
s.set_write_callback(write_data, stm.as_mut() as *mut _ as *mut _);
let buffer_size_bytes =
latency_frames * stm.output_sample_spec.frame_size() as u32;
let battr = pa_buffer_attr {
maxlength: u32::max_value(),
- prebuf: 0,
+ prebuf: u32::max_value(),
fragsize: u32::max_value(),
tlength: buffer_size_bytes * 2,
minreq: buffer_size_bytes / 4,
};
let device_name = super::try_cstr_from(output_device as *const _);
let mut stream_flags = pulse::StreamFlags::AUTO_TIMING_UPDATE
| pulse::StreamFlags::INTERPOLATE_TIMING
| pulse::StreamFlags::START_CORKED
@@ -596,19 +596,41 @@ impl<'ctx> PulseStream<'ctx> {
impl<'ctx> Drop for PulseStream<'ctx> {
fn drop(&mut self) {
self.destroy();
}
}
impl<'ctx> StreamOps for PulseStream<'ctx> {
fn start(&mut self) -> Result<()> {
+ fn output_preroll(_: &pulse::MainloopApi, u: *mut c_void) {
+ let stm = unsafe { &mut *(u as *mut PulseStream) };
+ if !stm.shutdown {
+ let size = stm
+ .output_stream
+ .as_ref()
+ .map_or(0, |s| s.writable_size().unwrap_or(0));
+ stm.trigger_user_callback(std::ptr::null(), size);
+ }
+ }
self.shutdown = false;
self.cork(CorkState::uncork() | CorkState::notify());
+ if self.output_stream.is_some() {
+ /* When doing output-only or duplex, we need to manually call user cb once in order to
+ * make things roll. This is done via a defer event in order to execute it from PA
+ * server thread. */
+ self.context.mainloop.lock();
+ self.context
+ .mainloop
+ .get_api()
+ .once(output_preroll, self as *const _ as *mut _);
+ self.context.mainloop.unlock();
+ }
+
Ok(())
}
fn stop(&mut self) -> Result<()> {
{
self.context.mainloop.lock();
self.shutdown = true;
// If draining is taking place wait to finish
--- a/toolkit/library/rust/shared/Cargo.toml
+++ b/toolkit/library/rust/shared/Cargo.toml
@@ -15,17 +15,17 @@ nsstring = { path = "../../../../xpcom/r
netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }
xpcom = { path = "../../../../xpcom/rust/xpcom" }
prefs_parser = { path = "../../../../modules/libpref/parser" }
static_prefs = { path = "../../../../modules/libpref/init/static_prefs" }
profiler_helper = { path = "../../../../tools/profiler/rust-helper", optional = true }
mozurl = { path = "../../../../netwerk/base/mozurl" }
webrender_bindings = { path = "../../../../gfx/webrender_bindings", optional = true }
cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev = "4ee3b283182926f9a8bb31d603219ff2db70d2fd", optional = true }
-cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="3ad5978575f501ab10b1753626f176f1bba3f584", optional = true, features=["pulse-dlopen"] }
+cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="0d168cc5be8865b21694b1b0c5a1c810de104e46", optional = true, features=["pulse-dlopen"] }
cubeb-sys = { version = "0.9", optional = true, features=["gecko-in-tree"] }
encoding_glue = { path = "../../../../intl/encoding_glue" }
audioipc-client = { git = "https://github.com/mozilla/audioipc-2", rev = "7537bfadad2e981577eb75e4f13662fc517e1a09", optional = true }
audioipc-server = { git = "https://github.com/mozilla/audioipc-2", rev = "7537bfadad2e981577eb75e4f13662fc517e1a09", optional = true }
authenticator = "0.3.1"
gkrust_utils = { path = "../../../../xpcom/rust/gkrust_utils" }
gecko_logger = { path = "../../../../xpcom/rust/gecko_logger" }
rsdparsa_capi = { path = "../../../../dom/media/webrtc/sdp/rsdparsa_capi" }