NetBSD Problem Report #2010

From gnats  Thu Feb  1 07:26:50 1996
Received: from animal.cs.chalmers.se by pain.lcs.mit.edu (8.6.12/8.6.12) with ESMTP id HAA10506 for <gnats-bugs@gnats.netbsd.org>; Thu, 1 Feb 1996 07:19:36 -0500
Message-Id: <199602011219.NAA16551@animal.cs.chalmers.se>
Date: Thu, 1 Feb 1996 13:19:25 +0100 (MET)
From: Lennart Augustsson <augustss@cs.chalmers.se>
Reply-To: augustss@cs.chalmers.se
To: gnats-bugs@gnats.netbsd.org
Subject: audio driver get unsynchronized when outputting silence
X-Send-Pr-Version: 3.95

>Number:         2010
>Category:       kern
>Synopsis:       audio driver get unsynchronized when outputting silence
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 01 07:35:10 +0000 1996
>Closed-Date:    Mon Feb 05 21:07:05 +0000 1996
>Last-Modified:  Mon Feb 05 21:11:46 +0000 1996
>Originator:     Lennart Augustsson
>Release:        NetBSD 1.1 current, 1996 Jan 31
>Organization:
CS at Chalmers University of Technology
>Environment:
System: NetBSD calvin.cs.chalmers.se 1.1A NetBSD 1.1A (CALVIN) #29: Thu Feb 1 12:52:52 MET 1996 augustss@calvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/CALVIN i386


>Description:
	If, while playing, the audio driver finds that there is nothing
	to play it starts outputting silence.  These silence blocks
	do not come from the ring buffer, but despite this the driver
	counts down the number of blocks in the ring buffer when
	it has finished playing a (dummy) silence block.
>How-To-Repeat:
	Play something and interrupt the write to /dev/audio.
	Listen to the sound sometimes getting "confused" afterwards.
>Fix:

*** dev/audio.c.orig	Thu Feb  1 12:32:38 1996
--- dev/audio.c	Thu Feb  1 12:36:27 1996
***************
*** 1222,1227 ****
--- 1222,1228 ----

  	if (sc->pr.nblk > 0) {
  		u_char *hp = sc->pr.hp;
+ 		sc->sc_silence = 0;
  		if (rval = sc->hw_if->start_output(sc->hw_hdl, hp, sc->sc_blksize,
  		    				   audio_pint, (void *)sc)) {
  		    	DPRINTF(("audiostartp: failed: %d\n", rval));
***************
*** 1258,1264 ****
  	 * always fails and the output is always silence after the
  	 * first block.
  	 */
! 	if (--cb->nblk > 0) {
  		hp = cb->hp;
  		if (cb->cb_pause) {
  		    cb->cb_pdrops++;
--- 1259,1267 ----
  	 * always fails and the output is always silence after the
  	 * first block.
  	 */
! 	if (!sc->sc_silence)
! 	    cb->nblk--;
! 	if (cb->nblk > 0) {
  		hp = cb->hp;
  		if (cb->cb_pause) {
  		    cb->cb_pdrops++;
***************
*** 1273,1278 ****
--- 1276,1282 ----
  		    if (audiodebug > 1)
  		    	Dprintf("audio_pint: hp=0x%x cc=%d\n", hp, cc);
  #endif
+ 		    sc->sc_silence = 0;
  		    if (err = hw->start_output(sc->hw_hdl, hp, cc,
  					       audio_pint, (void *)sc)) {
  			    DPRINTF(("audio_pint restart failed: %d\n", err));
***************
*** 1296,1301 ****
--- 1300,1306 ----
  		    Dprintf("audio_pint: drops=%d auzero %d 0x%x\n", cb->cb_drops, cc, *(int *)auzero_block);
  #endif
   psilence:
+ 		sc->sc_silence = 1;
  		if (err = hw->start_output(sc->hw_hdl,
  		    			   auzero_block, cc,
  					   audio_pint, (void *)sc)) {
*** dev/audiovar.h.orig	Sat Oct 14 03:36:59 1995
--- dev/audiovar.h	Thu Feb  1 12:37:34 1996
***************
*** 118,121 ****
--- 118,122 ----
  	int	sc_rblks;	/* number of phantom record blocks */
  	int	sc_pencoding;	/* current encoding; play */
  	int	sc_rencoding;	/* current encoding; record */
+ 	int	sc_silence;	/* currently outputting audio_zero */
  };
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: scottr 
State-Changed-When: Mon Feb 5 16:07:05 EST 1996 
State-Changed-Why:  
Applied the suggested change. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.