Fix infinate loop in recoding on vs0.

This commit is contained in:
isaki 2002-03-17 03:20:40 +00:00
parent 28819987b7
commit ec23c6650c
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: audio.c,v 1.152 2002/03/16 08:58:49 isaki Exp $ */
/* $NetBSD: audio.c,v 1.153 2002/03/17 03:20:40 isaki Exp $ */
/*
* Copyright (c) 1991-1993 Regents of the University of California.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.152 2002/03/16 08:58:49 isaki Exp $");
__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.153 2002/03/17 03:20:40 isaki Exp $");
#include "audio.h"
#if NAUDIO > 0
@ -1194,7 +1194,7 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag)
while (uio->uio_resid > 0 && !error) {
if (sc->sc_rconvbuffer_end - sc->sc_rconvbuffer_begin <= 0) {
s = splaudio();
while (cb->used < hw_bits_per_sample / 8) {
while (cb->used * 8 < hw_bits_per_sample) {
if (!sc->sc_rbus) {
error = audiostartr(sc);
if (error) {
@ -1228,6 +1228,7 @@ audio_read(struct audio_softc *sc, struct uio *uio, int ioflag)
cc = used - cb->usedlow; /* maximum to read */
if (cc > sc->sc_rconvbuffer_size)
cc = sc->sc_rconvbuffer_size;
cc = cc * params->factor / params->factor_denom;
/* cc must be aligned by the sample size */
cc = (cc * 8 / hw_bits_per_sample) * hw_bits_per_sample / 8;
#ifdef DIAGNOSTIC