mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
audiolatency: Fix wave detection in buffers
-1/1000 is 0, so we were *always* detecting a buffer.
This commit is contained in:
parent
2ee16a5810
commit
8649cef462
1 changed files with 2 additions and 7 deletions
|
@ -335,7 +335,7 @@ buffer_has_wave (GstBuffer * buffer, GstPad * pad)
|
||||||
gst_buffer_unmap (buffer, &minfo);
|
gst_buffer_unmap (buffer, &minfo);
|
||||||
|
|
||||||
/* Return offset in microseconds */
|
/* Return offset in microseconds */
|
||||||
return offset / 1000;
|
return (offset > 0) ? offset / 1000 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstPadProbeReturn
|
static GstPadProbeReturn
|
||||||
|
@ -406,12 +406,7 @@ gst_audiolatency_sink_chain (GstPad * pad, GstObject * parent,
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pts += offset;
|
self->recv_pts = pts + offset;
|
||||||
/* Only measure latency using the first buffer of each tick wave */
|
|
||||||
if (pts - self->recv_pts <= 950 * 1000)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
self->recv_pts = pts;
|
|
||||||
latency = (self->recv_pts - self->send_pts);
|
latency = (self->recv_pts - self->send_pts);
|
||||||
gst_audiolatency_set_latency (self, latency);
|
gst_audiolatency_set_latency (self, latency);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue