From: David Henningsson Date: Mon, 31 Jan 2011 04:58:36 +0000 (+0100) Subject: Pulsesink: Allow chunks up to bufsize instead of segsize X-Git-Tag: RELEASE-0.10.29~663 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1e2c1467ae042a3c6bb1a6bc0c07aeff13ec5edb;p=platform%2Fupstream%2Fgst-plugins-good.git Pulsesink: Allow chunks up to bufsize instead of segsize By allowing larger chunks to be sent, PulseAudio will have a lower CPU usage. This is especially important on low-end machines, where PulseAudio can crash if packets are coming in at a higher rate than PulseAudio can process them. Signed-off-by: David Henningsson --- diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c index 9bebfec..295d93f 100644 --- a/ext/pulse/pulsesink.c +++ b/ext/pulse/pulsesink.c @@ -1339,11 +1339,11 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, towrite = out_samples * bps; - /* Only ever write segsize bytes at once. This will - * also limit the PA shm buffer to segsize + /* Only ever write bufsize bytes at once. This will + * also limit the PA shm buffer to bufsize */ - if (towrite > buf->spec.segsize) - towrite = buf->spec.segsize; + if (towrite > bufsize) + towrite = bufsize; if ((pbuf->m_writable < towrite) || (offset != pbuf->m_lastoffset)) { /* if no room left or discontinuity in offset, @@ -1392,9 +1392,9 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, } /* make sure we only buffer up latency-time samples */ - if (pbuf->m_writable > buf->spec.segsize) { + if (pbuf->m_writable > bufsize) { /* limit buffering to latency-time value */ - pbuf->m_writable = buf->spec.segsize; + pbuf->m_writable = bufsize; GST_LOG_OBJECT (psink, "Limiting buffering to %" G_GSIZE_FORMAT, pbuf->m_writable); @@ -1413,9 +1413,9 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample, pbuf->m_writable); /* Just to make sure that we didn't get more than requested */ - if (pbuf->m_writable > buf->spec.segsize) { + if (pbuf->m_writable > bufsize) { /* limit buffering to latency-time value */ - pbuf->m_writable = buf->spec.segsize; + pbuf->m_writable = bufsize; } }