]> git.tuebingen.mpg.de Git - paraslash.git/commit
alsa: Work around poll fd problems.
authorAndre Noll <maan@systemlinux.org>
Thu, 13 Jun 2013 08:53:55 +0000 (10:53 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 8 Mar 2014 13:45:20 +0000 (14:45 +0100)
commit3ac2a1478a7ad965bb48bec7d21aa49affd95d29
treee2272a31a4d32fc288e8639784eae4d7365ec8d7
parent393c52c9e726570a2ee287e9f7e103b619a28f73
alsa: Work around poll fd problems.

In its ->pre_select method the alsa writer adds the alsa poll file
descriptor to the set of fds to be monitored during the next select
call. When this fd is ready for I/O, select() returns and ->post_select
is called. Currently ->post_select checks if the alsa poll fd is set
and returns early if it is not.

The problem is that on some hardware/kernel/alsa-lib combinations,
the poll fd is never marked as ready for I/O. This happens at least
on the raspberry pi with linux-3.10.10 and alsa-lib-1.0.27. The result
is no audio at all.

We address this problem in two ways:

* In alsa_init() we remember the buffer duration for later use in
->pre_select where we ask the scheduler to impose half of the duration
as an upper bound on the select timeout.

* In ->post_select, if there is input data available, we don't
check any more whether the poll fd is ready but try to write
unconditionally. On EAGAIN, we read from the poll fd to discard any
pending events.
alsa_write.c