Skip to content

Commit

Permalink
feat: add marker bit when packetizing opus.
Browse files Browse the repository at this point in the history
incase of silence opus rtp payload sets the marker bit after a talking spurt.
usually the data in silence pacekts are empty, just use 1-2 bytes for header.

fixes #125
  • Loading branch information
ramyak-mehra committed Oct 13, 2024
1 parent 5c4c9d5 commit 719738d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/packet/opus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ impl Packetizer for OpusPacketizer {
}

fn is_marker(&mut self, data: &[u8], previous: Option<&[u8]>, last: bool) -> bool {
// TODO: dtx
false
match previous {
// silence packets are usually empty with 1-2 bytes header
Some(previous) => previous.len() < 3 && data.len() >= 3,
// first packet can always be considered as start of talk spurt
None => true,
}
}
}

Expand Down

0 comments on commit 719738d

Please sign in to comment.