From owner-freebsd-multimedia@FreeBSD.ORG Fri Jan 16 20:32:47 2004 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB65916A4CE for ; Fri, 16 Jan 2004 20:32:47 -0800 (PST) Received: from ns.kt-is.co.kr (ns.kt-is.co.kr [211.218.149.125]) by mx1.FreeBSD.org (Postfix) with ESMTP id D483D43D39 for ; Fri, 16 Jan 2004 20:32:45 -0800 (PST) (envelope-from yongari@kt-is.co.kr) Received: from michelle.kt-is.co.kr (ns2.kt-is.co.kr [220.76.118.193]) (authenticated bits=128) by ns.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i0H4UNAh088077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sat, 17 Jan 2004 13:30:23 +0900 (KST) Received: from michelle.kt-is.co.kr (localhost.kt-is.co.kr [127.0.0.1]) by michelle.kt-is.co.kr (8.12.10/8.12.10) with ESMTP id i0H4WbfX003270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 17 Jan 2004 13:32:37 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Received: (from yongari@localhost) by michelle.kt-is.co.kr (8.12.10/8.12.10/Submit) id i0H4Wb1d003269 for multimedia@freebsd.org; Sat, 17 Jan 2004 13:32:37 +0900 (KST) (envelope-from yongari@kt-is.co.kr) Date: Sat, 17 Jan 2004 13:32:37 +0900 From: Pyun YongHyeon To: multimedia@freebsd.org Message-ID: <20040117043236.GA3223@kt-is.co.kr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-Filter-Version: 1.11a (ns.kt-is.co.kr) Subject: PCM audio problem on 5.2R(Fix included) X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: yongari@kt-is.co.kr List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Jan 2004 04:32:48 -0000 Hello All I got two pcm audio problems on FreeBSD 5.2R.(These problems were not exist in 5.1R.) - Selecting a new song in play list of xmms, it takes about 1 seconds. - Output old-buffered cranky sound while terminating xmms if xmms playback was paused.(When xmms playback was stopped it does not happen.) The following is truss(1) output while xmms try to change new song. ... 0.000155886 poll(0x8150000,0x2,0x0) = 1 (0x1) 0.000131301 write(11,0x822be70,2560) = 2560 (0xa00) 0.000067327 ioctl(11,SNDCTL_DSP_GETOSPACE,0xbfabaf40) = 0 (0x0) 0.000177676 ioctl(11,SNDCTL_DSP_RESET,0x0) = 0 (0x0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0.000086882 fstat(11,0xbfabae80) = 0 (0x0) 0.000345016 fcntl(0xb,0x3,0x0) = 5 (0x5) 0.000165943 fcntl(0xb,0x4,0x1) = 0 (0x0) 0.999180343 close(11) = 0 (0x0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0.000238298 clock_gettime(0x0,0xbfaedfa8) = 0 (0x0) 0.000203937 clock_gettime(0x0,0xbfaedfa8) = 0 (0x0) 0.001563885 write(5,0x816b000,48) = 48 (0x30) ... As you can see, close(2) takes about 1 second. So I think previous SNDCTL_DSP_RESET ioctl was not handled properly. Here is patch. It seems it solves the above two issues on 5.2R. The patch adds missing locks and clears buffer(hard + soft) to ensure to not playing old-buffered data in close(2). The patch may be appilcable to -current. --- sys/dev/sound/pcm/dsp.c.ORG Tue Nov 11 14:38:28 2003 +++ sys/dev/sound/pcm/dsp.c Fri Jan 16 20:21:27 2004 @@ -664,10 +664,18 @@ case SNDCTL_DSP_RESET: DEB(printf("dsp reset\n")); - if (wrch) + if (wrch) { + CHN_LOCK(wrch); chn_abort(wrch); - if (rdch) + chn_resetbuf(wrch); + CHN_UNLOCK(wrch); + } + if (rdch) { + CHN_LOCK(rdch); chn_abort(rdch); + chn_resetbuf(rdch); + CHN_UNLOCK(rdch); + } break; case SNDCTL_DSP_SYNC: I'm not subscribed to this list. Please CC me. Thank you. Regards, Pyun YongHeyon -- Pyun YongHyeon