rtp: basepay: Only forward buffers if we have a segment

If there are pending buffers without a segment then they must come from
the caps only and should be forwarded at a later time, if any.

Also reject any incoming buffers if no segment was received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2037>
This commit is contained in:
Sebastian Dröge 2025-01-12 11:37:25 +02:00 committed by GStreamer Marge Bot
parent 536f4db5c1
commit 8e62e54cc9

View file

@ -790,6 +790,15 @@ impl RtpBasePay2 {
pub(super) fn finish_pending_packets(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
let mut state = self.state.borrow_mut();
if state.segment.is_none() {
if !state.pending_buffers.is_empty() {
// The queued buffers must be based on the caps only. They can be forwarded at a later
// time, if there is one.
gst::debug!(CAT, imp = self, "Can't finish buffers yet without segment");
}
return Ok(gst::FlowSuccess::Ok);
}
// As long as there are packets that can be finished, take all with the same PTS and put
// them into a buffer list.
while state
@ -1570,6 +1579,11 @@ impl RtpBasePay2 {
return Err(gst::FlowError::NotNegotiated);
}
if state.segment.is_none() {
gst::error!(CAT, imp = self, "Received buffers without segment");
return Err(gst::FlowError::Error);
}
if buffer.flags().contains(gst::BufferFlags::HEADER)
&& self.obj().class().as_ref().drop_header_buffers
{