[alsa-devel] snd_pcm_avail_update returns bogus values with the OSS PCM plugin
aamas at stud.ntnu.no
Fri Jul 17 21:50:15 CEST 2009
Quoting Takashi Iwai <tiwai at suse.de>:
> At Fri, 10 Jul 2009 10:29:55 +0200,
> Sindre Aamås wrote:
>> For the attached test case snd_pcm_avail_update returns values higher
>> than the buffer size when run with the OSS PCM plugin. Output of
>> alsa-info.sh is at
>> http://www.alsa-project.org/db/?f=77a873e55d5d6ca50d67a035a9d6b7e10cca179d .
> This is obviously a bug in OSS plugin (who thought of using this
> plugin seriously? :)
> The oneliner below should fix the problem.
Thanks! That largely fixes it.
There's still a problem when OSS doesn't support the requested
period size, however. It tends to use a larger fragment size if
the one requested is too small. The real fragment size isn't
generally returned by SNDCTL_DSP_SETFRAGMENT, but needs to be
queried for with SNDCTL_DSP_GETOSPACE/SNDCTL_DSP_GETISPACE.
There may not be a nice solution for this, since there's no way
to get a list/range of supported fragment sizes. It's a bit
troublesome though, as it seems ALSA picks a small period size
if it can, and the minimum allowed by the OSS plugin is often
smaller than OSS supports, which means that all clients that
don't restrict the minimum period size will typically be
More information about the Alsa-devel