From owner-freebsd-multimedia Mon Jul 14 00:03:25 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id AAA04716 for multimedia-outgoing; Mon, 14 Jul 1997 00:03:25 -0700 (PDT) Received: from elch.heim4.tu-clausthal.de (100@elch.heim4.tu-clausthal.de [139.174.244.250]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id AAA04705 for ; Mon, 14 Jul 1997 00:03:20 -0700 (PDT) Received: (from olli@localhost) by elch.heim4.tu-clausthal.de (8.8.5/8.8.5) id JAA18049; Mon, 14 Jul 1997 09:03:13 +0200 (MET DST) Message-Id: <199707140703.JAA18049@elch.heim4.tu-clausthal.de> Subject: Re: guspnp9: /dev/dsp close() hangs To: hasty@rah.star-gate.com (Amancio Hasty) Date: Mon, 14 Jul 1997 09:03:12 +0200 (MET DST) Cc: multimedia@freebsd.org In-Reply-To: <199707140406.VAA01095@rah.star-gate.com> from "Amancio Hasty" at Jul 13, 97 09:06:53 pm From: oliver.fromme@heim3.tu-clausthal.de (Oliver Fromme) X-Mailer: ELM [version 2.4 PL24 PGP6] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-multimedia@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Amancio Hasty wrote: > In sb_dsp_close: > Move down sb_free_irq to after dsp_cleanup. > > /* DMAbuf_close_dma (dev); */ > /* sb_dsp_command (0xd4); */ > dsp_cleanup(); > sb_free_irq(); Am I also supposed to comment out the DMAbuf_close_dma? I just moved sb_free_irq down, as you suggested, in both sb_dsp.c and sb16_dsp.c. The latter now looks like this (remember, this is FreeBSD 2.2.2): sb_dsp_command01 (0xd9); sb_dsp_command01 (0xd5); DISABLE_INTR (flags); RELEASE_DMA_CHN (dma8); if (dma16 != dma8) RELEASE_DMA_CHN (dma16); dsp_cleanup (); sb_free_irq (); dsp_busy = 0; RESTORE_INTR (flags); It doesn't seem to fix the problem. I spent the past 2 hours testing: On about 20% of all 44 kHz files, the 10 seconds block occurs at the close, and on about 4% of all 22 kHz files (all of that 16 bit stereo, on my AWE32). The follwoing shell script can be used for testing: ================== cut here ================== #!/bin/sh - if [ $# -ne 2 ]; then echo "Usage: `basename $0` " >&2 echo " = number of attempts" >&2 echo " = mpeg file to play" >&2 exit 1 fi ATTEMPT=$1 BLOCKS=0 while [ $ATTEMPT -gt 0 ]; do /usr/bin/printf "\rAttempts left: $ATTEMPT (of $1) " mpg123 -q "$2" & PID=$! sleep 2 kill -INT $PID sleep 1 if [ `ps -p $PID | wc -l` -gt 1 ]; then sleep 5 if [ `ps -p $PID | wc -l` -gt 1 ]; then echo "*** blocks." kill -INT $PID sleep 1 if [ `ps -p $PID | wc -l` -gt 1 ]; then kill -KILL $PID fi BLOCKS=`expr $BLOCKS + 1` fi fi ATTEMPT=`expr $ATTEMPT - 1` done /usr/bin/printf "\rBlocked $BLOCKS times (out of $1 attempts). \n" ================== cut here ================== I'd recommend that you turn the volume on your stereo down, unless you'd like to hear the first 2 seconds of your mpeg files 200 times. ;-) One side note: When I change the first "sleep 2" to "sleep 1", 22 kHz files _never_ block, while the behaviour for 44 kHz remains unchanged. Increasing the sleep value above 2 doesn't seem to change anything. And on another note, I also tried the follwoing: replaced the mpg123 with pcmplay, playing a 1 or 2 seconds raw pcm file, and removed the first kill. Same result, i.e. it's definitely not a bug in mpg123. Oliver PS: pcmplay is part of the audio/tosha FreeBSD port. -- Oliver Fromme, Leibnizstr. 18-61, 38678 Clausthal, Germany (Info: finger userinfo:olli@dorifer.heim3.tu-clausthal.de)