Module Name:    src
Committed By:   mlelstv
Date:           Mon Jun  5 16:26:05 UTC 2023

Modified Files:
        src/sys/dev/audio: audio.c

Log Message:
We cannot handle input with precision != stride yet.
Drain input buffer for unhandled input.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/dev/audio/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.143 src/sys/dev/audio/audio.c:1.144
--- src/sys/dev/audio/audio.c:1.143	Sun Apr 23 08:53:08 2023
+++ src/sys/dev/audio/audio.c	Mon Jun  5 16:26:05 2023
@@ -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 <sys/cdefs.h>
-__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 
 		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 
 		}
 		if (codec == NULL) {
 			TRACE(4, "unsupported hw format");
+			/* drain hwbuf */
+			auring_take(&mixer->hwbuf, count);
 			return;
 		}
 

Reply via email to