onvifaggregator: implement proper EOS support

We could otherwise busy loop in aggregate forever when the meta
sink pad received EOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/765>
This commit is contained in:
Mathieu Duponchelle 2022-05-24 21:06:29 +02:00 committed by GStreamer Marge Bot
parent 68c55ca413
commit 77260a8442

View file

@ -317,6 +317,15 @@ impl OnvifAggregator {
end
);
Ok(Some((self.media_sink_pad.pop_buffer().unwrap(), Some(end))))
} else if self.meta_sink_pad.is_eos() {
gst::debug!(
CAT,
obj: element,
"Media buffer spanning {} -> {} is ready (meta pad is EOS)",
start,
end
);
Ok(Some((self.media_sink_pad.pop_buffer().unwrap(), Some(end))))
} else if let Some(latest_frame) = state.meta_frames.iter().next_back() {
if latest_frame.timestamp > end {
gst::debug!(
@ -428,6 +437,8 @@ impl AggregatorImpl for OnvifAggregator {
element.set_position(buffer.pts().opt_add(buffer.duration()));
self.finish_buffer(element, buffer)
} else if self.media_sink_pad.is_eos() {
Err(gst::FlowError::Eos)
} else {
Err(AGGREGATOR_FLOW_NEED_DATA)
}