NetBSD Problem Report #52585
From www@NetBSD.org Sat Sep 30 14:22:52 2017
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 5801B7A297
for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Sep 2017 14:22:52 +0000 (UTC)
Message-Id: <20170930142251.591877A2A4@mollari.NetBSD.org>
Date: Sat, 30 Sep 2017 14:22:51 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: AUDIO_GETENC does not return actual encodings
X-Send-Pr-Version: www-1.0
>Number: 52585
>Category: kern
>Synopsis: AUDIO_GETENC does not return actual encodings
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: isaki
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat Sep 30 14:25:00 +0000 2017
>Closed-Date: Sat May 25 03:07:00 +0000 2019
>Last-Modified: Sat May 25 03:07:00 +0000 2019
>Originator: Tetsuya Isaki
>Release: NetBSD 8.99.3
>Organization:
>Environment:
NetBSD 8.99.3 i386
>Description:
ioctl(AUDIO_GETENC) always returns
slinear_le:16,slinear_be:16*,ulinear_le:16*,ulinear_be:16*,mulaw:8*,alaw:8*
(this is the output of "audioctl -n encodings")
but actually accepted encoding is different.
The current audio(4) also accepts ulinear8 or slinear32.
In addition, AUDIO_ENCODINGFLAG_EMULATED is not correct anymore.
>How-To-Repeat:
N/A
>Fix:
N/A
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->nat
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Mon, 04 Jun 2018 00:52:51 +0000
Responsible-Changed-Why:
I'll handle this.
From: Nathanial Sloss <nat@netbsd.org>
To: gnats-bugs@netbsd.org,
isaki@pastel-flower.jp
Cc:
Subject: Re: kern/52585 (AUDIO_GETENC does not return actual encodings)
Date: Mon, 4 Jun 2018 11:02:05 +1000
--Boundary-00=_O+IFbeKSHQ/FBKh
Content-Type: Text/Plain;
charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
Hi,
Please try the attached patch and let me know if it works for you and that it
addresses the PR.
Best regards,
Nat
--Boundary-00=_O+IFbeKSHQ/FBKh
Content-Type: text/x-patch;
charset="ISO-8859-1";
name="auconv-encodings.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="auconv-encodings.diff"
Index: auconv.c
===================================================================
RCS file: /cvsroot/src/sys/dev/auconv.c,v
retrieving revision 1.35
diff -u -p -r1.35 auconv.c
--- auconv.c 16 Dec 2017 16:09:36 -0000 1.35
+++ auconv.c 3 Jun 2018 23:52:16 -0000
@@ -2340,8 +2340,9 @@ auconv_create_encodings(const struct aud
{
struct audio_encoding_set *buf;
int capacity;
- int i;
+ int i, j;
int err;
+ static int enc_precision[] = { 8, 16, 32 };
#define ADD_ENCODING(enc, prec, flags) do { \
err = auconv_add_encoding(enc, prec, flags, &buf, &capacity); \
@@ -2358,120 +2359,29 @@ auconv_create_encodings(const struct aud
for (i = 0; i < nformats; i++) {
if (!AUFMT_IS_VALID(&formats[i]))
continue;
- switch (formats[i].encoding) {
- case AUDIO_ENCODING_SLINEAR_LE:
- ADD_ENCODING(formats[i].encoding,
- formats[i].precision, 0);
- ADD_ENCODING(AUDIO_ENCODING_SLINEAR_BE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ULINEAR_LE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ULINEAR_BE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
-#if NMULAW > 0
- if (formats[i].precision == 8
- || formats[i].precision == 16) {
- ADD_ENCODING(AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ALAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- }
-#endif
- break;
- case AUDIO_ENCODING_SLINEAR_BE:
- ADD_ENCODING(formats[i].encoding,
- formats[i].precision, 0);
- ADD_ENCODING(AUDIO_ENCODING_SLINEAR_LE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ULINEAR_LE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ULINEAR_BE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
-#if NMULAW > 0
- if (formats[i].precision == 8
- || formats[i].precision == 16) {
- ADD_ENCODING(AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ALAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- }
-#endif
- break;
- case AUDIO_ENCODING_ULINEAR_LE:
- ADD_ENCODING(formats[i].encoding,
- formats[i].precision, 0);
+
+ for (j = 0; j < __arraycount(enc_precision); j++) {
ADD_ENCODING(AUDIO_ENCODING_SLINEAR_BE,
- formats[i].precision,
+ enc_precision[j],
AUDIO_ENCODINGFLAG_EMULATED);
ADD_ENCODING(AUDIO_ENCODING_SLINEAR_LE,
- formats[i].precision,
+ enc_precision[j],
AUDIO_ENCODINGFLAG_EMULATED);
ADD_ENCODING(AUDIO_ENCODING_ULINEAR_BE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
-#if NMULAW > 0
- if (formats[i].precision == 8
- || formats[i].precision == 16) {
- ADD_ENCODING(AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ALAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- }
-#endif
- break;
- case AUDIO_ENCODING_ULINEAR_BE:
- ADD_ENCODING(formats[i].encoding,
- formats[i].precision, 0);
- ADD_ENCODING(AUDIO_ENCODING_SLINEAR_BE,
- formats[i].precision,
+ enc_precision[j],
AUDIO_ENCODINGFLAG_EMULATED);
ADD_ENCODING(AUDIO_ENCODING_ULINEAR_LE,
- formats[i].precision,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_SLINEAR_LE,
- formats[i].precision,
+ enc_precision[j],
AUDIO_ENCODINGFLAG_EMULATED);
+ }
#if NMULAW > 0
- if (formats[i].precision == 8
- || formats[i].precision == 16) {
- ADD_ENCODING(AUDIO_ENCODING_ULAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- ADD_ENCODING(AUDIO_ENCODING_ALAW, 8,
- AUDIO_ENCODINGFLAG_EMULATED);
- }
+ ADD_ENCODING(AUDIO_ENCODING_ULAW, 8,
+ AUDIO_ENCODINGFLAG_EMULATED);
+ ADD_ENCODING(AUDIO_ENCODING_ALAW, 8,
+ AUDIO_ENCODINGFLAG_EMULATED);
#endif
- break;
-
- case AUDIO_ENCODING_ULAW:
- case AUDIO_ENCODING_ALAW:
- case AUDIO_ENCODING_ADPCM:
- case AUDIO_ENCODING_MPEG_L1_STREAM:
- case AUDIO_ENCODING_MPEG_L1_PACKETS:
- case AUDIO_ENCODING_MPEG_L1_SYSTEM:
- case AUDIO_ENCODING_MPEG_L2_STREAM:
- case AUDIO_ENCODING_MPEG_L2_PACKETS:
- case AUDIO_ENCODING_MPEG_L2_SYSTEM:
- case AUDIO_ENCODING_AC3:
- ADD_ENCODING(formats[i].encoding,
- formats[i].precision, 0);
- break;
-
- case AUDIO_ENCODING_SLINEAR:
- case AUDIO_ENCODING_ULINEAR:
- case AUDIO_ENCODING_LINEAR:
- case AUDIO_ENCODING_LINEAR8:
- default:
- printf("%s: invalid encoding value "
- "for audio_format: %d\n",
- __func__, formats[i].encoding);
- break;
- }
+ ADD_ENCODING(formats[i].encoding,
+ formats[i].precision, 0);
}
*encodings = buf;
return 0;
--Boundary-00=_O+IFbeKSHQ/FBKh--
From: "Nathanial Sloss" <nat@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/52585 CVS commit: src/sys/dev
Date: Sat, 23 Jun 2018 03:18:49 +0000
Module Name: src
Committed By: nat
Date: Sat Jun 23 03:18:49 UTC 2018
Modified Files:
src/sys/dev: auconv.c
Log Message:
Add all encoding supported by the mixer.
Addresses PR kern/52585.
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/auconv.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: nat->kern-bug-people
Responsible-Changed-By: nat@NetBSD.org
Responsible-Changed-When: Wed, 08 May 2019 21:53:27 +0000
Responsible-Changed-Why:
Responsible-Changed-From-To: kern-bug-people->isaki
Responsible-Changed-By: isaki@NetBSD.org
Responsible-Changed-When: Sat, 25 May 2019 03:07:00 +0000
Responsible-Changed-Why:
Mine.
State-Changed-From-To: open->closed
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Sat, 25 May 2019 03:07:00 +0000
State-Changed-Why:
By merging isaki-audio2 branch, AUDIO_GETENC now returns encoding
list actually supported.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.