mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
gst-libs/gst/audio/gstbaseaudiosink.c: We can only use our optimal calibration if we prerolled before the latency exp...
Original commit message from CVS: * gst-libs/gst/audio/gstbaseaudiosink.c: (gst_base_audio_sink_sync_latency): We can only use our optimal calibration if we prerolled before the latency expired.
This commit is contained in:
parent
d0932b0aa1
commit
f36d9d6b08
2 changed files with 22 additions and 18 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2008-05-20 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst-libs/gst/audio/gstbaseaudiosink.c:
|
||||||
|
(gst_base_audio_sink_sync_latency):
|
||||||
|
We can only use our optimal calibration if we prerolled before the
|
||||||
|
latency expired.
|
||||||
|
|
||||||
2008-05-20 Tim-Philipp Müller <tim.muller at collabora co uk>
|
2008-05-20 Tim-Philipp Müller <tim.muller at collabora co uk>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -1025,6 +1025,7 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
|
||||||
GstBaseAudioSink *sink;
|
GstBaseAudioSink *sink;
|
||||||
GstClockTime itime, etime;
|
GstClockTime itime, etime;
|
||||||
GstClockTime rate_num, rate_denom;
|
GstClockTime rate_num, rate_denom;
|
||||||
|
GstClockTimeDiff jitter;
|
||||||
|
|
||||||
sink = GST_BASE_AUDIO_SINK (bsink);
|
sink = GST_BASE_AUDIO_SINK (bsink);
|
||||||
|
|
||||||
|
@ -1039,8 +1040,6 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
|
||||||
GST_OBJECT_UNLOCK (sink);
|
GST_OBJECT_UNLOCK (sink);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
GstClockTimeDiff jitter;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sink, "checking preroll");
|
GST_DEBUG_OBJECT (sink, "checking preroll");
|
||||||
|
|
||||||
/* first wait for the playing state before we can continue */
|
/* first wait for the playing state before we can continue */
|
||||||
|
@ -1077,23 +1076,24 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
|
||||||
* yet. if some other error occures, we continue. */
|
* yet. if some other error occures, we continue. */
|
||||||
} while (status == GST_CLOCK_UNSCHEDULED);
|
} while (status == GST_CLOCK_UNSCHEDULED);
|
||||||
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (sink);
|
GST_OBJECT_LOCK (sink);
|
||||||
GST_DEBUG_OBJECT (sink, "latency synced");
|
GST_DEBUG_OBJECT (sink, "latency synced");
|
||||||
|
|
||||||
/* if we are slaved to a clock, we need to set the initial
|
/* when we prerolled in time, we can accurately set the calibration,
|
||||||
* calibration */
|
* our internal clock should exactly have been the latency (== the running
|
||||||
switch (sink->priv->slave_method) {
|
* time of the external clock) */
|
||||||
case GST_BASE_AUDIO_SINK_SLAVE_SKEW:
|
|
||||||
case GST_BASE_AUDIO_SINK_SLAVE_RESAMPLE:
|
|
||||||
case GST_BASE_AUDIO_SINK_SLAVE_NONE:
|
|
||||||
default:
|
|
||||||
/* When we are prerolled, our internal clock should exactly have been the
|
|
||||||
* latency (== the running time of the external clock) */
|
|
||||||
etime = GST_ELEMENT_CAST (sink)->base_time + time;
|
etime = GST_ELEMENT_CAST (sink)->base_time + time;
|
||||||
itime = gst_base_audio_sink_get_time (sink->provided_clock, sink);
|
itime = gst_base_audio_sink_get_time (sink->provided_clock, sink);
|
||||||
break;
|
|
||||||
|
if (status == GST_CLOCK_EARLY) {
|
||||||
|
/* when we prerolled late, we have to take into account the lateness */
|
||||||
|
GST_DEBUG_OBJECT (sink, "late preroll, adding jitter");
|
||||||
|
etime += jitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* start ringbuffer so we can start slaving right away when we need to */
|
||||||
|
gst_ring_buffer_start (sink->ringbuffer);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sink,
|
GST_DEBUG_OBJECT (sink,
|
||||||
"internal time: %" GST_TIME_FORMAT " external time: %" GST_TIME_FORMAT,
|
"internal time: %" GST_TIME_FORMAT " external time: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (itime), GST_TIME_ARGS (etime));
|
GST_TIME_ARGS (itime), GST_TIME_ARGS (etime));
|
||||||
|
@ -1120,9 +1120,6 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink)
|
||||||
sink->priv->avg_skew = -1;
|
sink->priv->avg_skew = -1;
|
||||||
sink->next_sample = -1;
|
sink->next_sample = -1;
|
||||||
|
|
||||||
/* start ringbuffer so we can start slaving right away when we need to */
|
|
||||||
gst_ring_buffer_start (sink->ringbuffer);
|
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
|
Loading…
Reference in a new issue