mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-19 08:36:27 +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);
|
state.ccmux_filter.set_property("caps", ccmux_caps);
|
||||||
|
|
||||||
let max_size_time = settings.latency
|
let max_size_time = self.our_latency(state, &settings);
|
||||||
+ settings.translate_latency
|
|
||||||
+ settings.accumulate_time
|
|
||||||
+ CEAX08MUX_LATENCY;
|
|
||||||
|
|
||||||
gst::debug!(
|
gst::debug!(
|
||||||
CAT,
|
CAT,
|
||||||
|
@ -1377,6 +1374,23 @@ impl TranscriberBin {
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn our_latency(&self, state: &State, settings: &Settings) -> gst::ClockTime {
|
||||||
|
self.synthesis_latency(state)
|
||||||
|
+ settings.latency
|
||||||
|
+ settings.accumulate_time
|
||||||
|
+ CEAX08MUX_LATENCY
|
||||||
|
+ settings.translate_latency
|
||||||
|
+ CCCOMBINER_LATENCY
|
||||||
|
+ state
|
||||||
|
.framerate
|
||||||
|
.map(|f| {
|
||||||
|
2 * gst::ClockTime::SECOND
|
||||||
|
.mul_div_floor(f.denom() as u64, f.numer() as u64)
|
||||||
|
.unwrap()
|
||||||
|
})
|
||||||
|
.unwrap_or(gst::ClockTime::from_seconds(0))
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(clippy::single_match)]
|
#[allow(clippy::single_match)]
|
||||||
fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool {
|
fn src_query(&self, pad: &gst::Pad, query: &mut gst::QueryRef) -> bool {
|
||||||
use gst::QueryViewMut;
|
use gst::QueryViewMut;
|
||||||
|
@ -1388,23 +1402,8 @@ impl TranscriberBin {
|
||||||
let state = self.state.lock().unwrap();
|
let state = self.state.lock().unwrap();
|
||||||
if let Some(state) = state.as_ref() {
|
if let Some(state) = state.as_ref() {
|
||||||
let upstream_min = self.query_upstream_latency(state);
|
let upstream_min = self.query_upstream_latency(state);
|
||||||
let synthesis_min = self.synthesis_latency(state);
|
let min =
|
||||||
let settings = self.settings.lock().unwrap();
|
upstream_min + self.our_latency(state, &self.settings.lock().unwrap());
|
||||||
let min = upstream_min
|
|
||||||
+ synthesis_min
|
|
||||||
+ settings.latency
|
|
||||||
+ settings.accumulate_time
|
|
||||||
+ CEAX08MUX_LATENCY
|
|
||||||
+ settings.translate_latency
|
|
||||||
+ CCCOMBINER_LATENCY
|
|
||||||
+ state
|
|
||||||
.framerate
|
|
||||||
.map(|f| {
|
|
||||||
2 * gst::ClockTime::SECOND
|
|
||||||
.mul_div_floor(f.denom() as u64, f.numer() as u64)
|
|
||||||
.unwrap()
|
|
||||||
})
|
|
||||||
.unwrap_or(gst::ClockTime::from_seconds(0));
|
|
||||||
|
|
||||||
gst::debug!(CAT, imp = self, "calculated latency: {}", min);
|
gst::debug!(CAT, imp = self, "calculated latency: {}", min);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue