mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-19 00:26:29 +00:00
transcriberbin: take synthesis latency into account
and factor out a method to calculate the element's internal latency, to be shared with the code for calculating the size of the passthrough queues. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1930>
This commit is contained in:
parent
a71fd35ebf
commit
01b3e2a8f2
1 changed files with 20 additions and 21 deletions
|
@ -628,10 +628,7 @@ impl TranscriberBin {
|
|||
|
||||
state.ccmux_filter.set_property("caps", ccmux_caps);
|
||||
|
||||
let max_size_time = settings.latency
|
||||
+ settings.translate_latency
|
||||
+ settings.accumulate_time
|
||||
+ CEAX08MUX_LATENCY;
|
||||
let max_size_time = self.our_latency(state, &settings);
|
||||
|
||||
gst::debug!(
|
||||
CAT,
|
||||
|
@ -1377,21 +1374,8 @@ impl TranscriberBin {
|
|||
ret
|
||||
}
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool {
|
||||
use gst::QueryViewMut;
|
||||
|
||||
gst::log!(CAT, obj = pad, "Handling query {:?}", query);
|
||||
|
||||
match query.view_mut() {
|
||||
QueryViewMut::Latency(q) => {
|
||||
let state = self.state.lock().unwrap();
|
||||
if let Some(state) = state.as_ref() {
|
||||
let upstream_min = self.query_upstream_latency(state);
|
||||
let synthesis_min = self.synthesis_latency(state);
|
||||
let settings = self.settings.lock().unwrap();
|
||||
let min = upstream_min
|
||||
+ synthesis_min
|
||||
fn our_latency(&self, state: &State, settings: &Settings) -> gst::ClockTime {
|
||||
self.synthesis_latency(state)
|
||||
+ settings.latency
|
||||
+ settings.accumulate_time
|
||||
+ CEAX08MUX_LATENCY
|
||||
|
@ -1404,7 +1388,22 @@ impl TranscriberBin {
|
|||
.mul_div_floor(f.denom() as u64, f.numer() as u64)
|
||||
.unwrap()
|
||||
})
|
||||
.unwrap_or(gst::ClockTime::from_seconds(0));
|
||||
.unwrap_or(gst::ClockTime::from_seconds(0))
|
||||
}
|
||||
|
||||
#[allow(clippy::single_match)]
|
||||
fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool {
|
||||
use gst::QueryViewMut;
|
||||
|
||||
gst::log!(CAT, obj = pad, "Handling query {:?}", query);
|
||||
|
||||
match query.view_mut() {
|
||||
QueryViewMut::Latency(q) => {
|
||||
let state = self.state.lock().unwrap();
|
||||
if let Some(state) = state.as_ref() {
|
||||
let upstream_min = self.query_upstream_latency(state);
|
||||
let min =
|
||||
upstream_min + self.our_latency(state, &self.settings.lock().unwrap());
|
||||
|
||||
gst::debug!(CAT, imp = self, "calculated latency: {}", min);
|
||||
|
||||
|
|
Loading…
Reference in a new issue