kern/184380: [pcm] SNDCTL_DSP_SETFMT accepts unsupported values
Jan Beich
jbeich at tormail.org
Sat Nov 30 01:20:06 UTC 2013
>Number: 184380
>Category: kern
>Synopsis: [pcm] SNDCTL_DSP_SETFMT accepts unsupported values
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Nov 30 01:20:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator: Jan Beich
>Release: FreeBSD 11.0-CURRENT amd64
>Organization:
>Environment:
>Description:
According to SNDCTL_DSP_SETFMT documentation if the ioctl() succeeds
the application must check if value was accepted. Unfortunately, our
OSS implementation may return value that's not actually supported.
http://manuals.opensound.com/developer/SNDCTL_DSP_SETFMT.html
At least the following ports check requested format and would assume
AFMT_FLOAT is accepted if built with sys/soundcard.h from opensound.com.
devel/allegro-devel
emulators/wine
multimedia/audacious-plugins
multimedia/mplayer
multimedia/vlc
Probably, only Linux accepts AFMT_FLOAT which means apps built with
OSSv4 wouldn't work under linuxulator either.
>How-To-Repeat:
# kern/21073, audio/oss
$ ./dsp-record -b float
Trying 8012 Hz 1 Channel float Format
ioctl(SNDCTL_DSP_SETFMT) failed: Tried 16384, Got 16
# kern/21073, native
$ ./dsp-record -b float | head -1 | vis -m
Trying 8012 Hz 1 Channel float Format
Recording 8012 Hz 1 Channel float Format
=00=00=00=80=FF=FF=FF=7F=FA=FF=FF=7Fx=FF=FF=7F=E4=00=00=80=9B=FE=FF=7F
# audio/oss
$ ./test
0x00000010
# native
$ ./test
0x00004000
$ cat test.c
#include <sys/soundcard.h>
#include <fcntl.h>
#include <stdio.h>
#ifndef AFMT_FLOAT
#define AFMT_FLOAT 0x00004000
#endif
int main()
{
int fd = open("/dev/dsp", O_RDWR, 0);
int format = AFMT_FLOAT;
if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0)
return 1;
printf("%0#10x\n", format);
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list