Skip to content

Commit

Permalink
Handle data callbacks of size zero
Browse files Browse the repository at this point in the history
The client side does not allow CallbackData::Req of size zero. This
handles it on the server side by returning early.

The background for this is https://bugzilla.mozilla.org/show_bug.cgi?id=1907367
where something is causing data callbacks of size zero and tripping an
assertion, but we have not reproduced and an audit is not conclusive as
to where the root cause is.
  • Loading branch information
Pehrsons committed Aug 9, 2024
1 parent 3495905 commit e107147
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ impl ServerStreamCallbacks {
return cubeb::ffi::CUBEB_ERROR.try_into().unwrap();
}

if nframes == 0 {
// Optimization: skip the RPC call when there are no frames.
return 0;
}

let r = self.data_callback_rpc.call(CallbackReq::Data {
nframes,
input_frame_size: self.input_frame_size as usize,
Expand Down

0 comments on commit e107147

Please sign in to comment.