Fwd: SNDCTL_DSP_GETIPTR implementation

From: Andriy Gapon <avg_at_FreeBSD.org>
Date: Fri, 29 Apr 2011 08:59:39 +0300
I intend to commit the following change soon and MFC it after a short period of
time.  Please test it if you use multimedia applications, both native and Linux,
especially if they deal with audio recording/capture.

Thank you.

-------- Original Message --------
Message-ID: <4DB6F7BA.4070808_at_FreeBSD.org>
Date: Tue, 26 Apr 2011 19:50:02 +0300
From: Andriy Gapon <avg_at_FreeBSD.org>
To: multimedia_at_freebsd.org
Subject: SNDCTL_DSP_GETIPTR implementation

Guys,

I reading this http://manuals.opensound.com/developer/SNDCTL_DSP_GETOPTR.html
It says: "In mmap mode (only) the ptr field tells the location where the next
sample will be recorded."
In my opinion that means that we have a mistake in our code and the following
patch should be applied.  But I am not sufficiently familiar with this code.

--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
_at__at_ -1655,7 +1655,7 _at__at_ dsp_ioctl
 				/* XXX abusive DMA update: chn_rdupdate(rdch); */
 	        		a->bytes = sndbuf_gettotal(bs);
 	        		a->blocks = sndbuf_getblocks(bs) - rdch->blocks;
-	        		a->ptr = sndbuf_getreadyptr(bs);
+	        		a->ptr = sndbuf_getfreeptr(bs);
 				rdch->blocks = sndbuf_getblocks(bs);
 				CHN_UNLOCK(rdch);
 	    		} else

P.S. leading (indenting) whitespace in this file is a mess.

-- 
Andriy Gapon
Received on Fri Apr 29 2011 - 03:59:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:13 UTC