Skip to content

Commit

Permalink
RSDK-9239: Fix off by one buffer threshold waiting semantics. (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgottlieb authored Nov 11, 2024
1 parent 3f9aebb commit e8de541
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rpc/wrtc_base_channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ func (ch *webrtcBaseChannel) write(msg proto.Message) error {
if ch.ctx.Err() != nil {
return io.ErrClosedPipe
}
if ch.dataChannel.BufferedAmount() >= bufferThreshold {
// RSDK-9239: Only wait when we're strictly over the threshold. Pion invokes the registered
// callback (notify `bufferWriteCond`) when moving from larger than bufferThreshold to less
// than or equal to.
if ch.dataChannel.BufferedAmount() > bufferThreshold {
ch.bufferWriteCond.Wait()
continue
}
Expand Down

0 comments on commit e8de541

Please sign in to comment.