From 551b3db78adef2cd7148ef33c7257ea416775db7 Mon Sep 17 00:00:00 2001 From: mlelstv Date: Mon, 5 Jun 2023 16:26:05 +0000 Subject: We cannot handle input with precision != stride yet. Drain input buffer for unhandled input. --- sys/dev/audio/audio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c index a9e3ec689f3..60350dc8f0a 100644 --- a/sys/dev/audio/audio.c +++ b/sys/dev/audio/audio.c @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.143 2023/04/23 08:53:08 mlelstv Exp $ */ +/* $NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -181,7 +181,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.143 2023/04/23 08:53:08 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.144 2023/06/05 16:26:05 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -6095,7 +6095,8 @@ audio_rmixer_process(struct audio_softc *sc) codecarg.srcfmt = &mixer->hwbuf.fmt; codecarg.dstfmt = &mixer->mixfmt; codec = NULL; - if (audio_format2_is_linear(codecarg.srcfmt)) { + if (audio_format2_is_linear(codecarg.srcfmt) && + codecarg.srcfmt->stride == codecarg.srcfmt->precision) { switch (codecarg.srcfmt->stride) { case 8: codec = audio_linear8_to_internal; @@ -6115,6 +6116,8 @@ audio_rmixer_process(struct audio_softc *sc) } if (codec == NULL) { TRACE(4, "unsupported hw format"); + /* drain hwbuf */ + auring_take(&mixer->hwbuf, count); return; } -- cgit