rtp: av1depay: Don't return an error if parsing a packet fails

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1612>
This commit is contained in:
Sebastian Dröge 2024-06-13 15:09:01 +03:00 committed by GStreamer Marge Bot
parent 477855789d
commit 343680ffea

View file

@ -12,6 +12,7 @@ use gst::{glib, prelude::*, subclass::prelude::*};
use std::{
cmp::Ordering,
io::{Cursor, Read, Seek, SeekFrom},
ops::RangeInclusive,
};
use bitstream_io::{BitReader, BitWriter};
@ -170,14 +171,18 @@ impl crate::basedepay::RtpBaseDepay2Impl for RTPAv1Depay {
&self,
packet: &crate::basedepay::Packet,
) -> Result<gst::FlowSuccess, gst::FlowError> {
let res = self.handle_rtp_packet(packet);
if let Err(err) = res {
match self.handle_rtp_packet(packet) {
Ok(Some((seqnums, buffer))) => self
.obj()
.queue_buffer(PacketToBufferRelation::Seqnums(seqnums), buffer),
Ok(None) => Ok(gst::FlowSuccess::Ok),
Err(err) => {
gst::warning!(CAT, imp: self, "Failed to handle RTP packet: {err:?}");
self.reset(&mut self.state.borrow_mut());
self.obj().drop_packets(..=packet.ext_seqnum());
Ok(gst::FlowSuccess::Ok)
}
}
res
}
}
@ -185,7 +190,7 @@ impl RTPAv1Depay {
fn handle_rtp_packet(
&self,
packet: &crate::basedepay::Packet,
) -> Result<gst::FlowSuccess, gst::FlowError> {
) -> Result<Option<(RangeInclusive<u64>, gst::Buffer)>, gst::FlowError> {
gst::trace!(
CAT,
imp: self,
@ -390,15 +395,11 @@ impl RTPAv1Depay {
self.obj().drop_packets(..=packet.ext_seqnum());
}
}
drop(state);
if let Some(buffer) = buffer {
self.obj().queue_buffer(
PacketToBufferRelation::Seqnums(start_ext_seqnum..=packet.ext_seqnum()),
buffer,
)
Ok(Some((start_ext_seqnum..=packet.ext_seqnum(), buffer)))
} else {
Ok(gst::FlowSuccess::Ok)
Ok(None)
}
}