Subject: Re: /dev/sound, non-blocking IO, and select
To: None <tech-kern@NetBSD.org>
From: J Chapman Flack <email@example.com>
Date: 04/07/2005 08:20:26
> I can 'dd if=/dev/sound1 of=/dev/null ...' and 'cat /dev/sound1' without
> a problem, but reads in this application are hanging.
> Here's basically what I'm doing for setup:
> dev->info.play.sample_rate = dev->info.record.sample_rate = 8000;
> dev->info.play.channels = dev->info.record.channels = 1;
> dev->info.play.precision = dev->info.record.precision = 16;
> dev->info.play.encoding = dev->info.record.encoding =
It might be interesting to check if you can get the read to complete or not
depending on your chosen settings for sample rate, channels, precision, and
encoding. The essence of the PR I mentioned earlier was management of the
ring buffer and how its overall size relates to the sizes of the transactions
in and out of it, and IIRC those sizes can be affected by those parameters.
The parameters could be the difference between your app and the dd/cat (default
parameters), which you report as working.
The symptom in the PR was exactly that a read would never return. If you
build with AUDIO_DEBUG you might see audio_rint: drops ... messages.
Depending on the ring buffer and transaction sizes, the record interrupt
code can incorrectly think the buffer is full, and perpetually drop incoming
data, so no read can ever be satisfied.