Commit 1e985802 authored by Wim Taymans's avatar Wim Taymans
Browse files

pulsesink: clear ringbuffer when asked to

Since we map the ringbuffer to the pulseaudio internal ringbuffer, flush the
pulseaudio buffer when we are asked to clear the ringbuffer.
This avoids some leftover audio after a seek.
parent 9ab7cfd9
......@@ -132,6 +132,7 @@ static gboolean gst_pulseringbuffer_release (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_start (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_pause (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_stop (GstRingBuffer * buf);
static void gst_pulseringbuffer_clear (GstRingBuffer * buf);
static guint gst_pulseringbuffer_commit (GstRingBuffer * buf,
guint64 * sample, guchar * data, gint in_samples, gint out_samples,
gint * accum);
......@@ -188,6 +189,8 @@ gst_pulseringbuffer_class_init (GstPulseRingBufferClass * klass)
gstringbuffer_class->pause = GST_DEBUG_FUNCPTR (gst_pulseringbuffer_pause);
gstringbuffer_class->resume = GST_DEBUG_FUNCPTR (gst_pulseringbuffer_start);
gstringbuffer_class->stop = GST_DEBUG_FUNCPTR (gst_pulseringbuffer_stop);
gstringbuffer_class->clear_all =
GST_DEBUG_FUNCPTR (gst_pulseringbuffer_clear);
gstringbuffer_class->commit = GST_DEBUG_FUNCPTR (gst_pulseringbuffer_commit);
......@@ -798,6 +801,26 @@ cork_failed:
static void
gst_pulseringbuffer_clear (GstRingBuffer * buf)
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
pa_operation *o = NULL;
pa_threaded_mainloop_lock (psink->mainloop);
GST_DEBUG_OBJECT (psink, "clearing");
if (pbuf->stream) {
/* don't wait for the flush to complete */
if ((o = pa_stream_flush (pbuf->stream, NULL, pbuf)))
pa_operation_unref (o);
pa_threaded_mainloop_unlock (psink->mainloop);
/* start/resume playback ASAP, we don't uncork here but in the commit method */
static gboolean
gst_pulseringbuffer_start (GstRingBuffer * buf)
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