Merge branch 'master' into 0.11

This commit is contained in:
Wim Taymans 2011-08-19 16:12:01 +02:00
commit e1b795ac13

View file

@ -1429,9 +1429,7 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
towrite = out_samples * bpf;
/* Only ever write segsize bytes at once. This will
* also limit the PA shm buffer to segsize
*/
/* Wait for at least segsize bytes to become available */
if (towrite > buf->spec.segsize)
towrite = buf->spec.segsize;
@ -1480,7 +1478,7 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
goto uncork_failed;
}
/* we can't write a single byte, wait a bit */
/* we can't write segsize bytes, wait a bit */
GST_LOG_OBJECT (psink, "waiting for free space");
pa_threaded_mainloop_wait (mainloop);
@ -1488,14 +1486,10 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
goto was_paused;
}
/* make sure we only buffer up latency-time samples */
if (pbuf->m_writable > buf->spec.segsize) {
/* limit buffering to latency-time value */
pbuf->m_writable = buf->spec.segsize;
GST_LOG_OBJECT (psink, "Limiting buffering to %" G_GSIZE_FORMAT,
pbuf->m_writable);
}
/* Recalculate what we can write in the next chunk */
towrite = out_samples * bps;
if (pbuf->m_writable > towrite)
pbuf->m_writable = towrite;
GST_LOG_OBJECT (psink, "requesting %" G_GSIZE_FORMAT " bytes of "
"shared memory", pbuf->m_writable);
@ -1509,14 +1503,9 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
GST_LOG_OBJECT (psink, "got %" G_GSIZE_FORMAT " bytes of shared memory",
pbuf->m_writable);
/* Just to make sure that we didn't get more than requested */
if (pbuf->m_writable > buf->spec.segsize) {
/* limit buffering to latency-time value */
pbuf->m_writable = buf->spec.segsize;
}
}
if (pbuf->m_writable < towrite)
if (towrite > pbuf->m_writable)
towrite = pbuf->m_writable;
avail = towrite / bpf;