mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 21:41:03 +00:00
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:
parent
68c55ca413
commit
77260a8442
1 changed files with 11 additions and 0 deletions
|
@ -317,6 +317,15 @@ impl OnvifAggregator {
|
||||||
end
|
end
|
||||||
);
|
);
|
||||||
Ok(Some((self.media_sink_pad.pop_buffer().unwrap(), Some(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() {
|
} else if let Some(latest_frame) = state.meta_frames.iter().next_back() {
|
||||||
if latest_frame.timestamp > end {
|
if latest_frame.timestamp > end {
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
|
@ -428,6 +437,8 @@ impl AggregatorImpl for OnvifAggregator {
|
||||||
element.set_position(buffer.pts().opt_add(buffer.duration()));
|
element.set_position(buffer.pts().opt_add(buffer.duration()));
|
||||||
|
|
||||||
self.finish_buffer(element, buffer)
|
self.finish_buffer(element, buffer)
|
||||||
|
} else if self.media_sink_pad.is_eos() {
|
||||||
|
Err(gst::FlowError::Eos)
|
||||||
} else {
|
} else {
|
||||||
Err(AGGREGATOR_FLOW_NEED_DATA)
|
Err(AGGREGATOR_FLOW_NEED_DATA)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue