]> git.tuebingen.mpg.de Git - paraslash.git/commit
vss: Mmap audio files using MAP_POPULATE.
authorAndre Noll <maan@systemlinux.org>
Mon, 26 Sep 2011 06:27:18 +0000 (08:27 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 26 Sep 2011 06:27:18 +0000 (08:27 +0200)
commit7bba6232e873b7a6acc95ac05b4e333f86a51a46
treeb91bfc21ad6a6c31d4e5482272c94e994ef926ad
parentf60bda0c58218b9c5a617e82c2dcdd7c2f203fb5
vss: Mmap audio files using MAP_POPULATE.

This fixes buffer underruns on an old laptop containing a
slow IDE disk. The problem was that getting the next chunk
from the map sometimes hit the disk and took more than 300ms.

This patch adds MAP_POPULATE to the flags for mmap() to
turn on read-ahead for the mapping. This almost fixed the
problem, but some buffer underruns remained. Moreover,
MAP_POPULATE is only available on Linux. To fix also the
remaining cases, we now read one byte from each of the next
few pages in the map after a chunk has been sent. This way
the next chunk should already be cached when it is needed.
vss.c