NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/54667: libossaudio returns incorrect recording sample rate



>Number:         54667
>Category:       lib
>Synopsis:       libossaudio returns incorrect recording sample rate
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 30 19:20: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);

>Unformatted:
 	
 	


Home | Main Index | Thread Index | Old Index