File gst-pulsesink-bufsize.diff of Package gstreamer-0_10-plugins-good
From 1e2c1467ae042a3c6bb1a6bc0c07aeff13ec5edb Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Mon, 31 Jan 2011 04:58:36 +0000
Subject: 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 <david.henningsson@canonical.com>
---
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;
}
}
--
cgit v0.8.3-6-g21f6