mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-22 17:08:18 +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();
|
let settings = self.settings.lock().unwrap();
|
||||||
|
|
||||||
if state.current_latency.is_some() {
|
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
|
state.current_latency
|
||||||
} else {
|
} else {
|
||||||
0.into()
|
0.into()
|
||||||
};
|
};
|
||||||
|
|
||||||
gst_debug!(self.cat, obj: element, "Returning latency {}", latency);
|
let max = 5 * state.current_latency;
|
||||||
q.set(true, latency, gst::CLOCK_TIME_NONE);
|
|
||||||
|
gst_debug!(
|
||||||
|
self.cat,
|
||||||
|
obj: element,
|
||||||
|
"Returning latency min {} max {}",
|
||||||
|
min,
|
||||||
|
max
|
||||||
|
);
|
||||||
|
q.set(true, min, max);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
@ -493,14 +493,22 @@ impl BaseSrcImpl for NdiVideoSrc {
|
||||||
let settings = self.settings.lock().unwrap();
|
let settings = self.settings.lock().unwrap();
|
||||||
|
|
||||||
if state.current_latency.is_some() {
|
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
|
state.current_latency
|
||||||
} else {
|
} else {
|
||||||
0.into()
|
0.into()
|
||||||
};
|
};
|
||||||
|
|
||||||
gst_debug!(self.cat, obj: element, "Returning latency {}", latency);
|
let max = 5 * state.current_latency;
|
||||||
q.set(true, latency, gst::CLOCK_TIME_NONE);
|
|
||||||
|
gst_debug!(
|
||||||
|
self.cat,
|
||||||
|
obj: element,
|
||||||
|
"Returning latency min {} max {}",
|
||||||
|
min,
|
||||||
|
max
|
||||||
|
);
|
||||||
|
q.set(true, min, max);
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in a new issue