Module Name:    src
Committed By:   martin
Date:           Thu Aug 31 11:10:37 UTC 2017

Modified Files:
        src/sys/dev [netbsd-8]: audio.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #238):
        sys/dev/audio.c: revision 1.392
        sys/dev/audio.c: revision 1.386
        sys/dev/audio.c: revision 1.387
Reset mixer ports on opening /dev/sound.
This fixes an issue reported on port-arm@ by Brian Buhrow.

Ensure to call mix write if inserting silence into the hw ring.
Addresses PR kern/52459.
Patch provided and tested by isaki@.

If the harware ring is starved of data...Insert silence into the mix ring
so mix_write can function properly.


To generate a diff of this commit:
cvs rdiff -u -r1.357.2.4 -r1.357.2.5 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.357.2.4 src/sys/dev/audio.c:1.357.2.5
--- src/sys/dev/audio.c:1.357.2.4	Tue Aug  1 23:25:11 2017
+++ src/sys/dev/audio.c	Thu Aug 31 11:10:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.357.2.4 2017/08/01 23:25:11 snj Exp $	*/
+/*	$NetBSD: audio.c,v 1.357.2.5 2017/08/31 11:10:37 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <[email protected]>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.4 2017/08/01 23:25:11 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.5 2017/08/31 11:10:37 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2242,6 +2242,8 @@ audio_open(dev_t dev, struct audio_softc
 	error = audio_set_defaults(sc, mode, vc);
 	if (!error && ISDEVSOUND(dev) && sc->sc_aivalid == true) {
 		sc->sc_ai.mode = mode;
+		sc->sc_ai.play.port = ~0;
+		sc->sc_ai.record.port = ~0;
 		error = audiosetinfo(sc, &sc->sc_ai, true, vc);
 	}
 	if (error)
@@ -3684,20 +3686,18 @@ audio_pint(void *v)
 		DPRINTFN(3, ("HW RING - INSERT SILENCE\n"));
 		used = blksize;
 		while (used > 0) {
-			cc = vc->sc_mpr.s.end - vc->sc_mpr.s.inp;
+			cc = sc->sc_pr.s.end - sc->sc_pr.s.inp;
 			if (cc > used)
 				cc = used;
-			audio_fill_silence(&vc->sc_pparams, vc->sc_mpr.s.inp, cc);
-			vc->sc_mpr.s.inp = audio_stream_add_inp(&vc->sc_mpr.s,
-			    vc->sc_mpr.s.inp, cc);
+			audio_fill_silence(&vc->sc_pustream->param, sc->sc_pr.s.inp, cc);
+			sc->sc_pr.s.inp = audio_stream_add_inp(&sc->sc_pr.s,
+			    sc->sc_pr.s.inp, cc);
 			used -= cc;
 		}
-		goto wake_mix;
 	}
 
 	mix_write(sc);
 
-wake_mix:
 	cv_broadcast(&sc->sc_condvar);
 }
 

Reply via email to