Commit 0c4c1410 authored by Wim Taymans's avatar Wim Taymans
Browse files

baseaudiosink: use new clock time methods

Use the unadjusted internal clock times to calculate the internal/external
offset when calibrating the clock.

When going to NULL, unparent and free the ringbuffer, like we do in the source
element.
See #578506
parent 4231d548
......@@ -868,7 +868,7 @@ gst_base_audio_sink_resample_slaving (GstBaseAudioSink * sink,
/* sample clocks and figure out clock skew */
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
itime = gst_clock_get_internal_time (sink->provided_clock);
itime = gst_audio_clock_get_time (sink->provided_clock);
/* add new observation */
gst_clock_add_observation (sink->provided_clock, itime, etime, &r_squared);
......@@ -921,7 +921,7 @@ gst_base_audio_sink_skew_slaving (GstBaseAudioSink * sink,
/* sample clocks and figure out clock skew */
etime = gst_clock_get_time (GST_ELEMENT_CLOCK (sink));
itime = gst_clock_get_internal_time (sink->provided_clock);
itime = gst_audio_clock_get_time (sink->provided_clock);
GST_DEBUG_OBJECT (sink,
"internal %" GST_TIME_FORMAT " external %" GST_TIME_FORMAT
......@@ -1127,7 +1127,7 @@ gst_base_audio_sink_sync_latency (GstBaseSink * bsink, GstMiniObject * obj)
* our internal clock should exactly have been the latency (== the running
* time of the external clock) */
etime = GST_ELEMENT_CAST (sink)->base_time + time;
itime = gst_clock_get_internal_time (sink->provided_clock);
itime = gst_audio_clock_get_time (sink->provided_clock);
if (status == GST_CLOCK_EARLY) {
/* when we prerolled late, we have to take into account the lateness */
......@@ -1788,6 +1788,10 @@ gst_base_audio_sink_change_state (GstElement * element,
gst_ring_buffer_activate (sink->ringbuffer, FALSE);
gst_ring_buffer_release (sink->ringbuffer);
gst_ring_buffer_close_device (sink->ringbuffer);
GST_OBJECT_LOCK (sink);
gst_object_unparent (GST_OBJECT_CAST (sink->ringbuffer));
sink->ringbuffer = NULL;
GST_OBJECT_UNLOCK (sink);
break;
default:
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment