Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev audioclear needs first channel in the queue not 0 (f...



details:   https://anonhg.NetBSD.org/src/rev/a78d72093425
branches:  trunk
changeset: 823086:a78d72093425
user:      nat <nat%NetBSD.org@localhost>
date:      Tue Apr 11 23:49:17 2017 +0000

description:
audioclear needs first channel in the queue not 0 (fixes panic).
Ignore the interrupt completely (audio_[pr]int) if not open.

diffstat:

 sys/dev/audio.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r 14b646c245c4 -r a78d72093425 sys/dev/audio.c
--- a/sys/dev/audio.c   Tue Apr 11 23:26:33 2017 +0000
+++ b/sys/dev/audio.c   Tue Apr 11 23:49:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.320 2017/04/03 04:09:12 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.321 2017/04/11 23:49:17 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.320 2017/04/03 04:09:12 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.321 2017/04/11 23:49:17 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3601,7 +3601,7 @@
        vc = chan->vc;
        blksize = vc->sc_mpr.blksize;
 
-       if (sc->sc_dying == true)
+       if (sc->sc_dying == true || sc->sc_opens == 0)
                return;
 
        if (vc->sc_draining == true) {
@@ -3818,7 +3818,7 @@
 
        KASSERT(mutex_owned(sc->sc_intr_lock));
 
-       if (sc->sc_dying == true)
+       if (sc->sc_dying == true || sc->sc_recopens == 0)
                return;
 
        blksize = audio_stream_get_used(&sc->sc_rr.s);
@@ -5418,6 +5418,7 @@
        vc = chan->vc;
        blksize = vc->sc_mrr.blksize;
        cc = blksize;
+       error = 0;
 
        if (sc->hw_if->trigger_input && sc->sc_rec_started == false) {
                DPRINTF(("%s: call trigger_input\n", __func__));
@@ -5429,11 +5430,11 @@
                error = sc->hw_if->start_input(sc->hw_hdl,
                    vc->sc_mrr.s.inp, blksize,
                    audio_rint, (void *)sc);
-               if (error) {
-                       /* XXX does this really help? */
-                       DPRINTF(("audio_upmix restart failed: %d\n", error));
-                       audio_clear(sc, 0);
-               }
+       }
+       if (error) {
+               /* XXX does this really help? */
+               DPRINTF(("audio_upmix restart failed: %d\n", error));
+               audio_clear(sc, SIMPLEQ_FIRST(&sc->sc_audiochan)->vc);
        }
        sc->sc_rec_started = true;
 
@@ -5547,7 +5548,7 @@
        if (error) {
                /* XXX does this really help? */
                DPRINTF(("audio_mix restart failed: %d\n", error));
-               audio_clear(sc, 0);
+               audio_clear(sc, SIMPLEQ_FIRST(&sc->sc_audiochan)->vc);
                sc->sc_trigger_started = false;
        }
 }



Home | Main Index | Thread Index | Old Index