cea708mux: Stop with EOS if all pads are EOS instead of continuing forever

Also don't drop buffers if multiple tries are needed for aggregating
because some pads are not ready yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1774>
This commit is contained in:
Sebastian Dröge 2024-09-17 09:52:54 +03:00 committed by GStreamer Marge Bot
parent 29b54ed2fc
commit d69d0f8738

View file

@ -127,6 +127,7 @@ impl AggregatorImpl for Cea708Mux {
.nseconds();
let end_running_time = start_running_time + duration;
let mut need_data = false;
let mut all_eos = true;
gst::debug!(
CAT,
imp = self,
@ -144,15 +145,20 @@ impl AggregatorImpl for Cea708Mux {
.expect("Not a Cea708MuxSinkPad?!")
}) {
let mut pad_state = pad.imp().pad_state.lock().unwrap();
pad_state.pending_buffer = None;
// any data we currently have stored
let have_pending = pad_state
.pending_services
.values()
.any(|codes| !codes.is_empty());
if pad.is_eos() {
if pad_state.pending_buffer.is_some() {
all_eos = false;
}
continue;
}
all_eos = false;
let buffer = if let Some(buffer) = pad.peek_buffer() {
buffer
} else {
@ -229,6 +235,9 @@ impl AggregatorImpl for Cea708Mux {
if need_data && !timeout {
return Err(gst_base::AGGREGATOR_FLOW_NEED_DATA);
}
if all_eos {
return Err(gst::FlowError::Eos);
}
self.obj()
.selected_samples(start_running_time, None, duration, None);