From owner-freebsd-bugs@FreeBSD.ORG Sat Nov 30 01:20:06 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 007083C8 for ; Sat, 30 Nov 2013 01:20:05 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CFF261B89 for ; Sat, 30 Nov 2013 01:20:05 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id rAU1K5kt022732 for ; Sat, 30 Nov 2013 01:20:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id rAU1K5Kn022731; Sat, 30 Nov 2013 01:20:05 GMT (envelope-from gnats) Resent-Date: Sat, 30 Nov 2013 01:20:05 GMT Resent-Message-Id: <201311300120.rAU1K5Kn022731@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jan Beich Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CD021C2 for ; Sat, 30 Nov 2013 01:14:05 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 89C4B1B2C for ; Sat, 30 Nov 2013 01:14:05 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rAU1E4XV053429 for ; Sat, 30 Nov 2013 01:14:04 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rAU1E4mf053426; Sat, 30 Nov 2013 01:14:04 GMT (envelope-from nobody) Message-Id: <201311300114.rAU1E4mf053426@oldred.freebsd.org> Date: Sat, 30 Nov 2013 01:14:04 GMT From: Jan Beich To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/184380: [pcm] SNDCTL_DSP_SETFMT accepts unsupported values X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Nov 2013 01:20:06 -0000 >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 #include #include #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: