mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-06 09:18:43 +00:00
Always return 1 frame of latency except for timecode mode
This allows for some slack when receiving, as up to 1 frame difference between receive times can easily happen because of capturing alone. And return 5 frames maximum latency as that is the size of our internal queue.
This commit is contained in:
parent
fa9f788190
commit
5e5007091e
2 changed files with 22 additions and 6 deletions
|
@ -457,14 +457,22 @@ impl BaseSrcImpl for NdiAudioSrc {
|
|||
let settings = self.settings.lock().unwrap();
|
||||
|
||||
if state.current_latency.is_some() {
|
||||
let latency = if settings.timestamp_mode == TimestampMode::Timestamp {
|
||||
let min = if settings.timestamp_mode != TimestampMode::Timecode {
|
||||
state.current_latency
|
||||
} else {
|
||||
0.into()
|
||||
};
|
||||
|
||||
gst_debug!(self.cat, obj: element, "Returning latency {}", latency);
|
||||
q.set(true, latency, gst::CLOCK_TIME_NONE);
|
||||
let max = 5 * state.current_latency;
|
||||
|
||||
gst_debug!(
|
||||
self.cat,
|
||||
obj: element,
|
||||
"Returning latency min {} max {}",
|
||||
min,
|
||||
max
|
||||
);
|
||||
q.set(true, min, max);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -493,14 +493,22 @@ impl BaseSrcImpl for NdiVideoSrc {
|
|||
let settings = self.settings.lock().unwrap();
|
||||
|
||||
if state.current_latency.is_some() {
|
||||
let latency = if settings.timestamp_mode == TimestampMode::Timestamp {
|
||||
let min = if settings.timestamp_mode != TimestampMode::Timecode {
|
||||
state.current_latency
|
||||
} else {
|
||||
0.into()
|
||||
};
|
||||
|
||||
gst_debug!(self.cat, obj: element, "Returning latency {}", latency);
|
||||
q.set(true, latency, gst::CLOCK_TIME_NONE);
|
||||
let max = 5 * state.current_latency;
|
||||
|
||||
gst_debug!(
|
||||
self.cat,
|
||||
obj: element,
|
||||
"Returning latency min {} max {}",
|
||||
min,
|
||||
max
|
||||
);
|
||||
q.set(true, min, max);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Reference in a new issue