Skip to content

Commit

Permalink
Bug 1730518 - Update audioipc to 8381f381. r=cubeb-reviewers,chunmin
Browse files Browse the repository at this point in the history
  • Loading branch information
kinetiknz committed Oct 14, 2021
1 parent 66e4e5f commit a95c6bf
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rev = "5ada876e8b73246b9bb0b5855f9143a0a9848467"
[source."https://github.com/mozilla/audioipc-2"]
git = "https://github.com/mozilla/audioipc-2"
replace-with = "vendored-sources"
rev = "fce878ff15f4e1dba1e5b54f82460af605fb4d14"
rev = "8381f3812354d8d1df972c2c3ea596b70caa9a84"

[source."https://github.com/mozilla/application-services"]
git = "https://github.com/mozilla/application-services"
Expand Down
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion third_party/rust/audioipc-client/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"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}
{"files":{"Cargo.toml":"67c604fd4e26eca79328eff5c235e6df79b3e4bdcd59609cf15ae6ffa7221b8b","cbindgen.toml":"bd89c5a9f52395b1c703ff04d1c0019dc3c92b691d571ae503c4b85753a44a39","src/context.rs":"89e2929aa2ba4bddcec6dd4a4511f528c681b7717adbaa7b7df4378c8e3c4d1c","src/lib.rs":"7755001c8caf6899ca5ed00a517d7bf1b6425fe17157a97037dae619af567fc9","src/send_recv.rs":"450bdb1d8a346634c0237f2081b424d11e2c19ad81670009303f8a03b3bfb196","src/stream.rs":"3b4937214a40fd41f817596af0c315100d8922a642fe99b33ada94c3e15a8fe5"},"package":null}
1 change: 1 addition & 0 deletions third_party/rust/audioipc-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ futures = { version="0.1.18", default-features=false, features=["use_std"] }
futures-cpupool = { version="0.1.8", default-features=false }
log = "0.4"
tokio = "0.1"
fallible_collections = "0.4"
29 changes: 24 additions & 5 deletions third_party/rust/audioipc-client/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use audioipc::{
messages::{self, CallbackReq, CallbackResp, ClientMessage, ServerMessage},
};
use cubeb_backend::{ffi, DeviceRef, Error, Result, Stream, StreamOps};
use fallible_collections::FallibleVec;
use futures::Future;
use futures_cpupool::{CpuFuture, CpuPool};
use std::ffi::{CStr, CString};
Expand Down Expand Up @@ -197,14 +198,32 @@ impl rpc::Server for CallbackServer {
})
}
CallbackReq::SharedMem(mut handle, shm_area_size) => {
let shm = unsafe {
SharedMem::from(handle.take_handle(), shm_area_size)
.expect("Client failed to set up shmem")
self.shm = match unsafe { SharedMem::from(handle.take_handle(), shm_area_size) } {
Ok(shm) => Some(shm),
Err(e) => {
warn!(
"sharedmem client mapping failed (size={}, err={:?})",
shm_area_size, e
);
return self
.cpu_pool
.spawn_fn(move || Ok(CallbackResp::Error(ffi::CUBEB_ERROR)));
}
};
self.shm = Some(shm);

self.duplex_input = if let StreamDirection::Duplex = self.dir {
Some(Vec::with_capacity(shm_area_size))
match Vec::try_with_capacity(shm_area_size) {
Ok(duplex_input) => Some(duplex_input),
Err(e) => {
warn!(
"duplex_input allocation failed (size={}, err={:?})",
shm_area_size, e
);
return self
.cpu_pool
.spawn_fn(move || Ok(CallbackResp::Error(ffi::CUBEB_ERROR)));
}
}
} else {
None
};
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/audioipc-server/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"files":{"Cargo.toml":"6329179497fb654bec0dea9f3642056309de3fa37d4042a48d18224e7b4742d3","cbindgen.toml":"bd89c5a9f52395b1c703ff04d1c0019dc3c92b691d571ae503c4b85753a44a39","src/lib.rs":"5da72fb551ea8a15df71e9d9e260e20d5c9571194b5d523bc39b257b2393f60f","src/server.rs":"c7495bc5299dd55da3f3e9254e2e872cdbd01ee2523adde71898f9102a596cf0"},"package":null}
{"files":{"Cargo.toml":"6329179497fb654bec0dea9f3642056309de3fa37d4042a48d18224e7b4742d3","cbindgen.toml":"bd89c5a9f52395b1c703ff04d1c0019dc3c92b691d571ae503c4b85753a44a39","src/lib.rs":"5da72fb551ea8a15df71e9d9e260e20d5c9571194b5d523bc39b257b2393f60f","src/server.rs":"9d465274fdb147f581d834ba61e47f4fbcbc1c83495279220be1b10b93ee6031"},"package":null}
32 changes: 25 additions & 7 deletions third_party/rust/audioipc-server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -759,13 +759,31 @@ impl CubebServer {
let user_ptr = server_stream.cbs.as_ref() as *const ServerStreamCallbacks as *mut c_void;

// SharedMem setup message should've been processed by client by now.
if let Err(e) = server_stream.shm_setup.take().wait() {
// If the client errored before responding, log error and fail stream init.
debug!(
"Shmem setup for stream {:?} failed (error {:?})",
stm_tok, e
);
return Err(e.into());
match server_stream.shm_setup.take().wait() {
Ok(Some(CallbackResp::SharedMem)) => {}
Ok(Some(CallbackResp::Error(e))) => {
// If the client replied with an error (e.g. client OOM), log error and fail stream init.
debug!(
"Shmem setup for stream {:?} failed (raw error {:?})",
stm_tok, e
);
return Ok(ClientMessage::Error(e));
}
Ok(r) => {
debug!(
"Shmem setup for stream {:?} failed (unexpected response {:?})",
stm_tok, r
);
return Ok(error(cubeb::Error::error()));
}
Err(e) => {
// If the client errored before responding, log error and fail stream init.
debug!(
"Shmem setup for stream {:?} failed (error {:?})",
stm_tok, e
);
return Err(e.into());
}
}

let stream = unsafe {
Expand Down
2 changes: 1 addition & 1 deletion third_party/rust/audioipc/.cargo-checksum.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"files":{"Cargo.toml":"0b9a3ce0f238c34e8d12eb867010ed5948f138d9a9b8a1be6812ac433335eea5","build.rs":"3f061cf9a989f63a71c693a543d26f7003e8b643c39c23ea555110252a2c39d2","src/async_msg.rs":"27c5c8215bcbe1364947065ac78198bcd4be7fbae0f5e49ea776cb454c5a6d2c","src/cmsg.rs":"97d8fe99ef94f75db9ed26cb4cf6faf9fbbc913cfa4152a8774ff4e76aead620","src/cmsghdr.c":"d7344b3dc15cdce410c68669b848bb81f7fe36362cd3699668cb613fa05180f8","src/codec.rs":"2e0a05968e07617adc6be0cbf04962c952c621e118f0db308eeeed5ccea4dfce","src/core.rs":"721de353d3b0b5126bf5b25cfb1f99244702309ce9f9f24cc2ce3c5858228794","src/errors.rs":"67a4a994d0724397657581cde153bdfc05ce86e7efc467f23fafc8f64df80fa4","src/framing.rs":"45122f0bc44458d8e111466437e784f0d17035309cb5f03d45a5861082168ea1","src/lib.rs":"717151468773630600530a16d6c89ba559e321551e95e0f3d83721474ec82ae6","src/messages.rs":"ea118af0c8f6ea37efa4b07b57a99328fd3f4d85b67e86d6e374ae68ca805635","src/messagestream_unix.rs":"786ea7d2d2993c21987d34c0617abd78dbaa57079de68ea3ebbf5611a052f60b","src/messagestream_win.rs":"f5b2a0e22f56a14af24a76a4c13a1d6b066fbea347132a5413bee0bd2b757753","src/msg.rs":"f5353e942f7818742190541e568685d6b4d6200b55bfc60e46ee3db05f802436","src/rpc/client/mod.rs":"04e80b689548e7888b34441a7224dfa8cf557b8b4164754daee95a95b76f9aee","src/rpc/client/proxy.rs":"8d9c9b38ecec4ab5ee3b6e4c2d7aea9dbb4f7cf5c25d39a5db0c76aa41008497","src/rpc/driver.rs":"dea4efc844485e98c21f766772422e3a5c9ac153ade32c0ff51287516a05690b","src/rpc/mod.rs":"3b14af0be2b4c7b30a0dab9cca353e092652a16e29002f5aeba24dca45e33d1e","src/rpc/server.rs":"7caf0b2d659783b4c5c9dd9efe4cb9a2e7d5955c0dfda3d2e79581116bb9334b","src/shm.rs":"94dee9454acfb4541b7757fd6763b8ecfe1961bb0da780caf463dc6509ba1d98","src/tokio_named_pipes.rs":"c0d74ab6330ebdec53db12f0f532b60897c37e70345c368f10165d9b31409643","src/tokio_uds_stream.rs":"3251b91e4129f174a588648ec43575b35e139b67d4b8833fe324e82e67d5c3da"},"package":null}
{"files":{"Cargo.toml":"0b9a3ce0f238c34e8d12eb867010ed5948f138d9a9b8a1be6812ac433335eea5","build.rs":"3f061cf9a989f63a71c693a543d26f7003e8b643c39c23ea555110252a2c39d2","src/async_msg.rs":"27c5c8215bcbe1364947065ac78198bcd4be7fbae0f5e49ea776cb454c5a6d2c","src/cmsg.rs":"97d8fe99ef94f75db9ed26cb4cf6faf9fbbc913cfa4152a8774ff4e76aead620","src/cmsghdr.c":"d7344b3dc15cdce410c68669b848bb81f7fe36362cd3699668cb613fa05180f8","src/codec.rs":"2e0a05968e07617adc6be0cbf04962c952c621e118f0db308eeeed5ccea4dfce","src/core.rs":"721de353d3b0b5126bf5b25cfb1f99244702309ce9f9f24cc2ce3c5858228794","src/errors.rs":"67a4a994d0724397657581cde153bdfc05ce86e7efc467f23fafc8f64df80fa4","src/framing.rs":"45122f0bc44458d8e111466437e784f0d17035309cb5f03d45a5861082168ea1","src/lib.rs":"717151468773630600530a16d6c89ba559e321551e95e0f3d83721474ec82ae6","src/messages.rs":"6d59588add4dc4eb324a630980fa10acd64ad5e1feda74a9ec10b0f7d10798f1","src/messagestream_unix.rs":"786ea7d2d2993c21987d34c0617abd78dbaa57079de68ea3ebbf5611a052f60b","src/messagestream_win.rs":"f5b2a0e22f56a14af24a76a4c13a1d6b066fbea347132a5413bee0bd2b757753","src/msg.rs":"f5353e942f7818742190541e568685d6b4d6200b55bfc60e46ee3db05f802436","src/rpc/client/mod.rs":"04e80b689548e7888b34441a7224dfa8cf557b8b4164754daee95a95b76f9aee","src/rpc/client/proxy.rs":"8d9c9b38ecec4ab5ee3b6e4c2d7aea9dbb4f7cf5c25d39a5db0c76aa41008497","src/rpc/driver.rs":"dea4efc844485e98c21f766772422e3a5c9ac153ade32c0ff51287516a05690b","src/rpc/mod.rs":"3b14af0be2b4c7b30a0dab9cca353e092652a16e29002f5aeba24dca45e33d1e","src/rpc/server.rs":"7caf0b2d659783b4c5c9dd9efe4cb9a2e7d5955c0dfda3d2e79581116bb9334b","src/shm.rs":"94dee9454acfb4541b7757fd6763b8ecfe1961bb0da780caf463dc6509ba1d98","src/tokio_named_pipes.rs":"c0d74ab6330ebdec53db12f0f532b60897c37e70345c368f10165d9b31409643","src/tokio_uds_stream.rs":"3251b91e4129f174a588648ec43575b35e139b67d4b8833fe324e82e67d5c3da"},"package":null}
1 change: 1 addition & 0 deletions third_party/rust/audioipc/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ pub enum CallbackResp {
State,
DeviceChange,
SharedMem,
Error(c_int),
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down
4 changes: 2 additions & 2 deletions toolkit/library/rust/shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ cubeb-coreaudio = { git = "https://github.com/mozilla/cubeb-coreaudio-rs", rev =
cubeb-pulse = { git = "https://github.com/mozilla/cubeb-pulse-rs", rev="e9e55a4529642da99e64452467ecaef9f7753531", 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 = "fce878ff15f4e1dba1e5b54f82460af605fb4d14", optional = true }
audioipc-server = { git = "https://github.com/mozilla/audioipc-2", rev = "fce878ff15f4e1dba1e5b54f82460af605fb4d14", optional = true }
audioipc-client = { git = "https://github.com/mozilla/audioipc-2", rev = "8381f3812354d8d1df972c2c3ea596b70caa9a84", optional = true }
audioipc-server = { git = "https://github.com/mozilla/audioipc-2", rev = "8381f3812354d8d1df972c2c3ea596b70caa9a84", optional = true }
authenticator = "0.3.1"
gkrust_utils = { path = "../../../../xpcom/rust/gkrust_utils" }
gecko_logger = { path = "../../../../xpcom/rust/gecko_logger" }
Expand Down

0 comments on commit a95c6bf

Please sign in to comment.