Received: by mail.netbsd.org (Postfix, from userid 605) id 3156384D21; Wed, 15 Apr 2020 15:25:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id A28A684EA1 for ; Wed, 15 Apr 2020 15:25:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id 4hes_RzcpORd for ; Wed, 15 Apr 2020 15:25:35 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 3637884D21 for ; Wed, 15 Apr 2020 15:25:35 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id C37BBFB27; Wed, 15 Apr 2020 15:25:33 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Wed, 15 Apr 2020 15:25:33 +0000 From: "Nia Alarie" Subject: CVS commit: src To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20200415152533.C37BBFB27@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Nia Alarie" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: nia Date: Wed Apr 15 15:25:33 UTC 2020 Modified Files: src/lib/libossaudio: ossaudio.c src/sys/compat/ossaudio: ossaudio.c Log Message: ossaudio: Make SNDCTL_DSP_SETFMT conform with OSSv4. The OSSv4 spec says we shouldn't really error if an invalid format is chosen by an application. Things are especially likely to be confused if we return MULAW, since in OSSv4 terms that means that's the native hardware format. Instead, set and return the current hardware format if an invalid format is chosen. For the 24-bit sample formats, note that the NetBSD kernel currently can't handle them in its default configuration, and will return an error code if you attempt to use them. So, if an applicaton requests 24-bit PCM, promote it to 32-bit PCM. According to the spec, this is valid and applications should be checking the return value anyway. In the Linux compat layer, we just use S16LE as a fallback. The OSSv3 headers that are still being shipped with Linux don't contain definitions for fancier formats and we can reasonably expect all applications to support S16LE. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/lib/libossaudio/ossaudio.c cvs rdiff -u -r1.79 -r1.80 src/sys/compat/ossaudio/ossaudio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.