mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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>
This commit is contained in:
parent
ede0635d45
commit
1e2c1467ae
1 changed files with 8 additions and 8 deletions
|
@ -1339,11 +1339,11 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
|
||||||
|
|
||||||
towrite = out_samples * bps;
|
towrite = out_samples * bps;
|
||||||
|
|
||||||
/* Only ever write segsize bytes at once. This will
|
/* Only ever write bufsize bytes at once. This will
|
||||||
* also limit the PA shm buffer to segsize
|
* also limit the PA shm buffer to bufsize
|
||||||
*/
|
*/
|
||||||
if (towrite > buf->spec.segsize)
|
if (towrite > bufsize)
|
||||||
towrite = buf->spec.segsize;
|
towrite = bufsize;
|
||||||
|
|
||||||
if ((pbuf->m_writable < towrite) || (offset != pbuf->m_lastoffset)) {
|
if ((pbuf->m_writable < towrite) || (offset != pbuf->m_lastoffset)) {
|
||||||
/* if no room left or discontinuity in offset,
|
/* 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 */
|
/* 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 */
|
/* 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,
|
GST_LOG_OBJECT (psink, "Limiting buffering to %" G_GSIZE_FORMAT,
|
||||||
pbuf->m_writable);
|
pbuf->m_writable);
|
||||||
|
@ -1413,9 +1413,9 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
|
||||||
pbuf->m_writable);
|
pbuf->m_writable);
|
||||||
|
|
||||||
/* Just to make sure that we didn't get more than requested */
|
/* 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 */
|
/* limit buffering to latency-time value */
|
||||||
pbuf->m_writable = buf->spec.segsize;
|
pbuf->m_writable = bufsize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue