[alsa-devel] Possible problem with snd_pcm_oss_sync()

Clemens Ladisch clemens at ladisch.de
Wed May 21 13:25:41 CEST 2008

Timur Tabi wrote:
> The customer is using an old application called "bplay" to test OSS audio
> support on our hardware.  The application works fine on x86, but fails on our
> PowerPC board.  It could be an endian issue, but I doubt it.

Is that a recent enough version of bplay, from Debian?  Older ones
didn't work on big-endian machines.

> #1) Stopped audio stream output after doing followings:
> 1. Opening /dev/mixer
> 2. Getting a channel value (0x00000001) that is used for "ioctl(fd,
> 3. Write audio volume information by "ioctl(fd,

I didn't find this in the bplay code.

If writing to a mixer control stops the audio stream, this may be a bug
in the driver (whatever driver this is).

> #2) Stopped audio stream output after doing following:
> 2. Executing command "ioctl(fd, SNDCTL_DSP_SYNC, NULL);",

This ioctl stops the output (after playing the remaining data in the
buffer).  The application can restart playing by writing more data.

> XXXX found that by commenting out the "sync_audio" function on the source
> code of "bplay" made "bplay" work. So XXXX suspects the implementation of the
> ioctl on the OSS emulation may have a problem.

bplay calls the SYNC ioctl before setting the sample format, but this is
not allowed: <http://manuals.opensound.com/developer/callorder.html>.

Removing that call to sync_audio() fixes the bug.  :-)

> snd_pcm_oss_sync() displays this message:
> sync: buffer_used
> What does this mean?

It means that the buffer contains some data which will be played before
the device is stopped and the ioctl returns.


More information about the Alsa-devel mailing list