mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-09-01 09:13:48 +00:00
textaccumulate: add mechanism for recalculating timeout ..
.. when queue fills again Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2528>
This commit is contained in:
parent
22168549fa
commit
ebc943e54c
1 changed files with 17 additions and 0 deletions
|
@ -217,6 +217,7 @@ enum AccumulateInput {
|
|||
},
|
||||
Event(gst::Event),
|
||||
Query(std::ptr::NonNull<gst::QueryRef>),
|
||||
RecalculateTimeout,
|
||||
}
|
||||
|
||||
// SAFETY: Need to be able to pass *mut gst::QueryRef
|
||||
|
@ -740,6 +741,9 @@ impl Accumulate {
|
|||
this.state.lock().unwrap().serialized_query_return = Some(res);
|
||||
this.serialized_query_cond.notify_all();
|
||||
}
|
||||
AccumulateInput::RecalculateTimeout => {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(RecvTimeoutError::Timeout) => {
|
||||
|
@ -847,6 +851,19 @@ impl Accumulate {
|
|||
}
|
||||
}
|
||||
|
||||
// The queue was empty and has started filling up again, recalculate timeout
|
||||
if state
|
||||
.input
|
||||
.as_ref()
|
||||
.map(|input| input.items.len())
|
||||
.unwrap_or(0)
|
||||
== 1
|
||||
{
|
||||
if let Some(tx) = state.accumulate_tx.as_ref() {
|
||||
let _ = tx.send(AccumulateInput::RecalculateTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
gst::trace!(CAT, imp = self, "input is now {:#?}", state.input);
|
||||
|
||||
Ok(gst::FlowSuccess::Ok)
|
||||
|
|
Loading…
Reference in a new issue