From owner-freebsd-bugs Tue Aug 1 5: 0: 5 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 4DAC437B886 for ; Tue, 1 Aug 2000 05:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id FAA06490; Tue, 1 Aug 2000 05:00:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id AC9CB37BCE1; Tue, 1 Aug 2000 04:55:29 -0700 (PDT) Message-Id: <20000801115529.AC9CB37BCE1@hub.freebsd.org> Date: Tue, 1 Aug 2000 04:55:29 -0700 (PDT) From: shirai@nintendo.co.jp To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/20340: SNDCTL_DSP_GETODELAY on pcm device is incorrectly implemented. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 20340 >Category: kern >Synopsis: SNDCTL_DSP_GETODELAY on pcm device is incorrectly implemented. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 01 05:00:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: Takashi SHIRAI >Release: 4-STABLE >Organization: Nintendo, Co., Ltd. >Environment: FreeBSD 4-STABLE >Description: According to OSS Programmer's Guide (http://www.opensound.com/pguide/), SNDCTL_DSP_GETODELAY returns the number of unplayed bytes in the kernel buffer. It means the length of ready areas (rl). But, in the latest implement, this call returns the total bytes played already. It is certainly mis-implement. >How-To-Repeat: Use any audio applications which use SNDCTL_DSP_GETODELAY. e.g. TiMidity++ (>= 3.5.1) >Fix: The following patch will be effective: diff -u dsp.c.old dsp.c --- dsp.c.old Tue Aug 1 04:36:13 2000 +++ dsp.c Tue Aug 1 20:18:08 2000 @@ -587,12 +587,13 @@ case SNDCTL_DSP_GETODELAY: if (wrch) { snd_dbuf *b = &wrch->buffer; + snd_dbuf *bs = &wrch->buffer2nd; if (b->dl) { chn_checkunderflow(wrch); if (!(wrch->flags & CHN_F_MAPPED)) while (chn_wrfeed(wrch) > 0); } - *arg = b->total; + *((int *)arg) = bs->rl; } else ret = EINVAL; break; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message