Skip to content

Commit

Permalink
Fix writer to skip packets with an empty payload
Browse files Browse the repository at this point in the history
  • Loading branch information
bhbs committed Nov 20, 2024
1 parent 95949fa commit 3614c2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions media/src/io/ivf_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ impl<W: Write + Seek> IVFWriter<W> {
impl<W: Write + Seek> Writer for IVFWriter<W> {
/// write_rtp adds a new packet and writes the appropriate headers for it
fn write_rtp(&mut self, packet: &rtp::packet::Packet) -> Result<()> {
if packet.payload.is_empty() {
return Ok(());
}

let mut depacketizer: Box<dyn Depacketizer> = if self.is_vp9 {
Box::<rtp::codecs::vp9::Vp9Packet>::default()
} else {
Expand Down
4 changes: 4 additions & 0 deletions media/src/io/ogg_writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ impl<W: Write + Seek> OggWriter<W> {
impl<W: Write + Seek> Writer for OggWriter<W> {
/// write_rtp adds a new packet and writes the appropriate headers for it
fn write_rtp(&mut self, packet: &rtp::packet::Packet) -> Result<()> {
if packet.payload.is_empty() {
return Ok(());
}

let mut opus_packet = rtp::codecs::opus::OpusPacket;
let payload = opus_packet.depacketize(&packet.payload)?;

Expand Down

0 comments on commit 3614c2f

Please sign in to comment.