NetBSD Problem Report #54667
From yorickhardy@gmail.com Wed Oct 30 19:19:01 2019
Return-Path: <yorickhardy@gmail.com>
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 8D6837A18E
for <gnats-bugs@gnats.NetBSD.org>; Wed, 30 Oct 2019 19:19:01 +0000 (UTC)
Message-Id: <5db9e221.1c69fb81.5624d.1765@mx.google.com>
Date: Wed, 30 Oct 2019 21:18:51 +0200
From: yorickhardy@gmail.com
Reply-To: yorickhardy@gmail.com
To: gnats-bugs@NetBSD.org
Subject: libossaudio returns incorrect recording sample rate
X-Send-Pr-Version: 3.95
>Number: 54667
>Category: lib
>Synopsis: libossaudio returns incorrect recording sample rate
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: isaki
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 30 19:20:00 +0000 2019
>Closed-Date: Sat Nov 02 12:03:06 +0000 2019
>Last-Modified: Tue Nov 19 11:05:00 +0000 2019
>Originator: Yorick Hardy
>Release: NetBSD 9.99.17
>Organization:
>Environment:
System: NetBSD HOME 9.99.17 NetBSD 9.99.17 (YORICK.amd64) #1: Sat Oct 26 00:06:47 SAST 2019 root@HOME:/root/build.amd64.local/obj/sys/arch/amd64/compile/YORICK.amd64 amd64
Architecture: x86_64
Machine: amd64
>Description:
The OSS SNDCTL_DSP_SPEED ioctl sets the desired sample rate and returns
the actual sample rate. However, libossaudio always returns the playback
sample rate. If the audio device is opened for recording only, then the
playback sample rate is the default playback sample rate instead of the
desired recording sample rate, and the wrong value is returned.
>How-To-Repeat:
$ ffmpeg4 -t 5 -f oss -sample_rate 11025 -i /dev/audio test.wav
where 11025 (adjust accordingly) is not the default *playback* rate
and observe that test.wav does not play back at the correct rate.
>Fix:
Index: lib/libossaudio/ossaudio.c
===================================================================
RCS file: /cvsroot/src/lib/libossaudio/ossaudio.c,v
retrieving revision 1.36
diff -u -r1.36 ossaudio.c
--- lib/libossaudio/ossaudio.c 2 Feb 2019 04:52:16 -0000 1.36
+++ lib/libossaudio/ossaudio.c 30 Oct 2019 19:02:51 -0000
@@ -134,7 +134,10 @@
retval = ioctl(fd, AUDIO_GETBUFINFO, &tmpinfo);
if (retval < 0)
return retval;
- INTARG = tmpinfo.play.sample_rate;
+ if (tmpinfo.mode == AUMODE_RECORD)
+ INTARG = tmpinfo.record.sample_rate;
+ else
+ INTARG = tmpinfo.play.sample_rate;
break;
case SNDCTL_DSP_STEREO:
AUDIO_INITINFO(&tmpinfo);
>Release-Note:
>Audit-Trail:
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54667 CVS commit: src/lib/libossaudio
Date: Sat, 2 Nov 2019 11:48:24 +0000
Module Name: src
Committed By: isaki
Date: Sat Nov 2 11:48:23 UTC 2019
Modified Files:
src/lib/libossaudio: ossaudio.c
Log Message:
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
Fix PR lib/54667.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libossaudio/ossaudio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "Tetsuya Isaki" <isaki@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54667 CVS commit: src/sys/compat/ossaudio
Date: Sat, 2 Nov 2019 11:56:34 +0000
Module Name: src
Committed By: isaki
Date: Sat Nov 2 11:56:34 UTC 2019
Modified Files:
src/sys/compat/ossaudio: ossaudio.c
Log Message:
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 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.
Responsible-Changed-From-To: lib-bug-people->isaki
Responsible-Changed-By: isaki@NetBSD.org
Responsible-Changed-When: Sat, 02 Nov 2019 12:03:06 +0000
Responsible-Changed-Why:
State-Changed-From-To: open->closed
State-Changed-By: isaki@NetBSD.org
State-Changed-When: Sat, 02 Nov 2019 12:03:06 +0000
State-Changed-Why:
Committed. Thank you for reporting.
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/54667 CVS commit: [netbsd-9] src
Date: Tue, 19 Nov 2019 11:01:28 +0000
Module Name: src
Committed By: martin
Date: Tue Nov 19 11:01:27 UTC 2019
Modified Files:
src/lib/libossaudio [netbsd-9]: ossaudio.c
src/sys/compat/ossaudio [netbsd-9]: ossaudio.c
Log Message:
Pull up following revision(s) (requested by isaki in ticket #446):
lib/libossaudio/ossaudio.c: revision 1.37
lib/libossaudio/ossaudio.c: revision 1.38
sys/compat/ossaudio/ossaudio.c: revision 1.77
sys/compat/ossaudio/ossaudio.c: revision 1.78
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
Fix PR lib/54667.
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.2.1 src/lib/libossaudio/ossaudio.c
cvs rdiff -u -r1.74.4.1 -r1.74.4.2 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.
>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.