From owner-freebsd-multimedia@FreeBSD.ORG Tue Apr 26 16:50:05 2011 Return-Path: Delivered-To: multimedia@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6CF12106566C for ; Tue, 26 Apr 2011 16:50:05 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id AE9008FC17 for ; Tue, 26 Apr 2011 16:50:04 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA26873; Tue, 26 Apr 2011 19:50:02 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4DB6F7BA.4070808@FreeBSD.org> Date: Tue, 26 Apr 2011 19:50:02 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110309 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: multimedia@FreeBSD.org X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: SNDCTL_DSP_GETIPTR implementation X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2011 16:50:05 -0000 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 @@ -1655,7 +1655,7 @@ 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