Module Name:    src
Committed By:   nat
Date:           Sat Apr 22 10:37:51 UTC 2017

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

Log Message:
If there is no data in the mix ring, insert silence.

This will ensure that the hardware output pointer remains valid.


To generate a diff of this commit:
cvs rdiff -u -r1.326 -r1.327 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.326 src/sys/dev/audio.c:1.327
--- src/sys/dev/audio.c:1.326	Mon Apr 17 22:40:06 2017
+++ src/sys/dev/audio.c	Sat Apr 22 10:37:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.326 2017/04/17 22:40:06 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.327 2017/04/22 10:37:51 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.326 2017/04/17 22:40:06 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.327 2017/04/22 10:37:51 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3598,12 +3598,17 @@ audio_pint(void *v)
 		cv_broadcast(&sc->sc_wchan);
 	}
 
-	if (audio_stream_get_used(&sc->sc_pr.s) < blksize)
-		goto wake_mix;
-
 	vc->sc_mpr.s.outp = audio_stream_add_outp(&vc->sc_mpr.s,
 	    vc->sc_mpr.s.outp, blksize);
 
+	if (audio_stream_get_used(&sc->sc_pr.s) < blksize) {
+		audio_fill_silence(&vc->sc_pparams, vc->sc_mpr.s.inp,
+		    vc->sc_mpr.blksize);
+		vc->sc_mpr.s.inp = audio_stream_add_inp(&vc->sc_mpr.s,
+		    vc->sc_mpr.s.inp, blksize);
+		goto wake_mix;
+	}
+
 	mix_write(sc);
 
 wake_mix:

Reply via email to