NetBSD Problem Report #54973
From www@netbsd.org Mon Feb 17 02:05:35 2020
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 298D41A9213
for <gnats-bugs@gnats.NetBSD.org>; Mon, 17 Feb 2020 02:05:35 +0000 (UTC)
Message-Id: <20200217020534.3DB431A9259@mollari.NetBSD.org>
Date: Mon, 17 Feb 2020 02:05:34 +0000 (UTC)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@NetBSD.org
Subject: audio regression with multi channel content and stereo hardware
X-Send-Pr-Version: www-1.0
>Number: 54973
>Category: kern
>Synopsis: audio regression with multi channel content and stereo hardware
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: isaki
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Feb 17 02:10:00 +0000 2020
>Closed-Date: Fri May 01 03:19:20 +0000 2020
>Last-Modified: Fri May 01 03:19:20 +0000 2020
>Originator: Jared McNeill
>Release: 9.99.46
>Organization:
>Environment:
NetBSD SEES 9.99.46 NetBSD 9.99.46 (GENERIC) #6: Sun Feb 16 21:45:07 AST 2020 jmcneill@SEES:/home/jmcneill/netbsd/cvs-src/sys/arch/amd64/compile/obj/GENERIC amd64
>Description:
When playing back a video file with 5.1 surround track using mpv, I noticed that there was sound but the speech was inaudible.
mpv uses libossaudio to detect hardware capabilities. It attempts to set the desired number of channels (6) with SNDCTL_DSP_CHANNELS, which is emulated using AUDIO_SETINFO and AUDIO_GETBUFINFO. This returns the number of emulated channels to userland, which is 6.
Since the source channel count is greater than hardware capabilities, the stream passes through audio_track_chmix_shrink. This function discards all but the front left and right channels. Unfortunately for 5.1 content, the voice is often carried in the center channel, so speech ends up being inaudible.
If the kernel is going to claim to support more channels than supported by the hardware, we need to downmix so this data is not lost.
>How-To-Repeat:
Use multimedia/mpv to playback a video with 5.1 surround audio on stereo audio hardware.
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: kern-bug-people->isaki
Responsible-Changed-By: isaki@NetBSD.org
Responsible-Changed-When: Mon, 17 Feb 2020 14:37:40 +0000
Responsible-Changed-Why:
I take it.
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54973 CVS commit: src/sys/dev/audio
Date: Sat, 22 Feb 2020 05:51:39 +0000
Module Name: src
Committed By: isaki
Date: Sat Feb 22 05:51:39 UTC 2020
Modified Files:
src/sys/dev/audio: audio.c
Log Message:
Limit the number of channels that userland apps can set (by AUDIO_SETINFO)
to the number of channels supported by the hardware or less, if the hardware
supports multi channels.
- On monaural or stereo hardware, userland apps can always set 1ch or 2ch.
The kernel (audio layer) can convert mono-stereo each other.
- On 3ch (2.1ch) hardware, for example, userland apps can set 1, 2, or 3ch,
but not 4ch or more.
This allows userland apps to know actual number of channels supported by
the hardware in the same way as before.
PR kern/54973.
To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/audio/audio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Sat, 22 Feb 2020 05:56:37 +0000
State-Changed-Why:
sys/dev/audio/audio.c,v 1.43 will fix your problem.
Could you confirm it?
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54973 CVS commit: src/share/man/man4
Date: Sat, 28 Mar 2020 04:55:08 +0000
Module Name: src
Committed By: isaki
Date: Sat Mar 28 04:55:08 UTC 2020
Modified Files:
src/share/man/man4: audio.4
Log Message:
Add description about channel limitation introduced in audio.c 1.43.
PR kern/54973.
To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/share/man/man4/audio.4
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Tetsuya Isaki <isaki@pastel-flower.jp>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org,
gnats-admin@netbsd.org,
jmcneill@invisible.ca
Subject: Re: kern/54973 (audio regression with multi channel content and stereo hardware)
Date: Sun, 19 Apr 2020 13:30:05 +0900
At Sat, 22 Feb 2020 05:56:38 +0000 (UTC),
isaki@NetBSD.org wrote:
> State-Changed-From-To: open->feedback
> State-Changed-By: isaki@NetBSD.org
> State-Changed-When: Sat, 22 Feb 2020 05:56:37 +0000
> State-Changed-Why:
> sys/dev/audio/audio.c,v 1.43 will fix your problem.
> Could you confirm it?
I'd like you to reply about this.
Thanks,
---
Tetsuya Isaki <isaki@pastel-flower.jp / isaki@NetBSD.org>
From: Jared McNeill <jmcneill@invisible.ca>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/54973: audio regression with multi channel content and
stereo hardware
Date: Mon, 27 Apr 2020 23:21:35 -0300 (ADT)
This now works correctly in -current. Thanks!
State-Changed-From-To: feedback->needs-pullups
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Wed, 29 Apr 2020 02:07:38 +0000
State-Changed-Why:
Thank you for feedback!
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54973 CVS commit: [netbsd-9] src
Date: Thu, 30 Apr 2020 15:40:51 +0000
Module Name: src
Committed By: martin
Date: Thu Apr 30 15:40:50 UTC 2020
Modified Files:
src/share/man/man4 [netbsd-9]: audio.4
src/sys/dev/audio [netbsd-9]: audio.c
Log Message:
Pull up following revision(s) (requested by isaki in ticket #875):
sys/dev/audio/audio.c: revision 1.59
share/man/man4/audio.4: revision 1.102
share/man/man4/audio.4: revision 1.103
sys/dev/audio/audio.c: revision 1.43
Limit the number of channels that userland apps can set (by AUDIO_SETINFO)
to the number of channels supported by the hardware or less, if the hardware
supports multi channels.
- On monaural or stereo hardware, userland apps can always set 1ch or 2ch.
The kernel (audio layer) can convert mono-stereo each other.
- On 3ch (2.1ch) hardware, for example, userland apps can set 1, 2, or 3ch,
but not 4ch or more.
This allows userland apps to know actual number of channels supported by
the hardware in the same way as before.
PR kern/54973.
Reinitialize the sticky parameters whenever the hardware format is changed.
When the number of the hardware channels becomes less than the number of
channels that sticky parameters remember, subsequent open("/dev/sound") will
fail without this treatment. This is for rev 1.43.
Add description about channel limitation introduced in audio.c 1.43.
PR kern/54973.
Remove trailing whitespace.
To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.90.2.1 src/share/man/man4/audio.4
cvs rdiff -u -r1.28.2.9 -r1.28.2.10 src/sys/dev/audio/audio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: needs-pullups->closed
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Fri, 01 May 2020 03:19:20 +0000
State-Changed-Why:
[pullup-9 #875] done.
Thank you for reporting!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.