[gst-cvs] gst-plugins-good: pulsesink: Flush shm buffer immediately if it's full

Sebastian Dröge slomo at kemper.freedesktop.org
Wed Jun 9 07:22:50 PDT 2010


Module: gst-plugins-good
Branch: master
Commit: bd5987a3d23fe17d4253854149c0c53d6bbc5122
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=bd5987a3d23fe17d4253854149c0c53d6bbc5122

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Wed Jun  9 16:22:27 2010 +0200

pulsesink: Flush shm buffer immediately if it's full

---

 ext/pulse/pulsesink.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index ff2ceea..7772d92 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -1392,6 +1392,19 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
       avail = towrite / bps;
     }
 
+    /* flush the buffer if it's full */
+    if ((pbuf->m_data != NULL) && (pbuf->m_towrite > 0)
+        && (pbuf->m_writable == 0)) {
+      GST_LOG_OBJECT (psink, "flushing %u samples at offset %" G_GINT64_FORMAT,
+          (guint) pbuf->m_towrite / bps, pbuf->m_offset);
+
+      if (pa_stream_write (pbuf->stream, (uint8_t *) pbuf->m_data,
+              pbuf->m_towrite, NULL, pbuf->m_offset, PA_SEEK_ABSOLUTE) < 0) {
+        goto write_failed;
+      }
+      pbuf->m_towrite = 0;
+      pbuf->m_offset = offset + towrite;        /* keep track of current offset */
+    }
 #else
 
     for (;;) {





More information about the Gstreamer-commits mailing list