Module Name:    src
Committed By:   nat
Date:           Thu Nov 16 23:43:48 UTC 2017

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

Log Message:
Use correct combination of mix ring block size and vc playring used low
for signalling the writer or fetching data from the vc play ring filters.

When dealing with the ring buffer sc_mpr.s it is necessary to use the hwvc
or mixring block sizes as they represent the final size of the data to be
played back from the stream vc.

When dealing with sc_pustream when there is play back filters or not one
should use the vc->sc_mpr.blocksize, as this represents the amount of data
before going through play back filters.

This should address PR kern/52685.


To generate a diff of this commit:
cvs rdiff -u -r1.439 -r1.440 src/sys/dev/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.c
diff -u src/sys/dev/audio.c:1.439 src/sys/dev/audio.c:1.440
--- src/sys/dev/audio.c:1.439	Thu Nov 16 23:32:11 2017
+++ src/sys/dev/audio.c	Thu Nov 16 23:43:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.439 2017/11/16 23:32:11 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.440 2017/11/16 23:43:48 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.439 2017/11/16 23:32:11 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.440 2017/11/16 23:43:48 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3802,7 +3802,7 @@ audio_mix(void *v)
 		 * at accurate timing.  If used < blksize, uaudio(4) already
 		 * request transfer of garbage data.
 		 */
-		if (used <= cb->usedlow && !cb->copying &&
+		if (used <= sc->sc_hwvc->sc_mpr.usedlow && !cb->copying &&
 		    vc->sc_npfilters > 0) {
 			/* we might have data in filter pipeline */
 			null_fetcher.fetch_to = null_fetcher_fetch_to;
@@ -3863,7 +3863,7 @@ audio_mix(void *v)
 			     audio_stream_get_used(&cb->s), cb->usedlow));
 
 		if ((vc->sc_mode & AUMODE_PLAY) && !cb->pause) {
-			if (audio_stream_get_used(&cb->s) <= cb->usedlow)
+			if (audio_stream_get_used(vc->sc_pustream) <= cb->usedlow)
 				sc->schedule_wih = true;
 		}
 		/* Possible to return one or more "phantom blocks" now. */

Reply via email to