Questionable code in sys/dev/sound/pcm/channel.c

Conrad J. Sabatier conrads at cox.net
Mon Jul 26 15:44:49 PDT 2004


On 26-Jul-2004 Don Lewis wrote:
> 
> I just looked at the code some more.  With timeout hardwired to 1,
> count can never go negative.  The code initializes count to hz, and
> then decrements it whenever chn_sleep() returns EWOULDBLOCK, and
> re-initializes count to hz if chn_sleep() returns zero.  With timeout
> hardwired to 1, count should only be able to decrement to zero if
> chn_sleep() returns EWOULDBLOCK hz times in a row, which means that
> nothing could be stuffed into the buffer for one second, which seems
> like a long time ...
> 
> I suspect that with your change the write() call is returning a 0 and
> the player software is doing a retry that succeeds (or this might be
> audible as a skip).

Hmmm.  Well, one thing's for certain: you've obviously managed to
discern more about what's going on in this code than me!  :-)

It would be nice to hear from our sound maintainers on this issue. 
They've been rather...quiet lately.  :-)

-- 
Conrad J. Sabatier <conrads at cox.net> -- "In Unix veritas"


More information about the freebsd-current mailing list