Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions audioipc/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ pub enum CallbackReq {
Data { nframes: isize },
State(ffi::cubeb_state),
DeviceChange,
Drain,
}

#[derive(Debug, Deserialize, Serialize)]
Expand All @@ -302,6 +303,7 @@ pub enum CallbackResp {
State,
DeviceChange,
Error(c_int),
Drain,
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down
1 change: 1 addition & 0 deletions client/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ impl rpccore::Server for CallbackServer {

CallbackResp::State
}
CallbackReq::Drain => CallbackResp::Drain,
CallbackReq::DeviceChange => {
run_in_callback(|| {
let cb = *self.device_change_cb.lock().unwrap();
Expand Down
22 changes: 18 additions & 4 deletions server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,24 @@ impl CubebServer {
.map(|_| ClientMessage::StreamStarted)
.unwrap_or_else(error),

ServerMessage::StreamStop(stm_tok) => try_stream!(self, stm_tok)
.stop()
.map(|_| ClientMessage::StreamStopped)
.unwrap_or_else(error),
ServerMessage::StreamStop(stm_tok) => {
let result = try_stream!(self, stm_tok).stop();
if result.is_ok() {
// Drain the callback pipe so any data callback already queued on
// it completes before we reply StreamStopped. An error here means
// the callback pipe is gone, so there is nothing left to drain.
if let Err(e) = self.streams[stm_tok]
.cbs
.data_callback_rpc
.call(CallbackReq::Drain)
{
debug!("StreamStop({stm_tok}): callback pipe drain failed: {e:?}");
}
}
result
.map(|_| ClientMessage::StreamStopped)
.unwrap_or_else(error)
}

ServerMessage::StreamGetPosition(stm_tok) => try_stream!(self, stm_tok)
.position()
Expand Down
Loading