From 0694be2a822f50eebaf72131358399d06fef2aa8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 18 Nov 2009 12:22:10 +0100 Subject: [PATCH] pulsesink: use acquired flag when checking valid state Use the acquired field of the ringbuffer in get_time to know when we are in an invalid state. We don't clear the rate flag when releasing the ringbuffer so this values is not usable. Avoids some error messages being posted because the pulseaudio connection is down. --- ext/pulse/pulsesink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index aec5da6..ecf18ea 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -1591,7 +1591,7 @@ gst_pulsesink_get_time (GstClock * clock, GstBaseAudioSink * sink) GstPulseRingBuffer *pbuf; pa_usec_t time; - if (sink->ringbuffer == NULL || sink->ringbuffer->spec.rate == 0) + if (!sink->ringbuffer || !sink->ringbuffer->acquired) return GST_CLOCK_TIME_NONE; pbuf = GST_PULSERING_BUFFER_CAST (sink->ringbuffer); -- 2.7.4