Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Be carefull with play-only/record-only devices. Sugg...



details:   https://anonhg.NetBSD.org/src/rev/9ff3f4e85cee
branches:  trunk
changeset: 353641:9ff3f4e85cee
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 15 12:07:32 2017 +0000

description:
Be carefull with play-only/record-only devices. Suggestion from Jared,
avoids a crash with hdmi audio.

diffstat:

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

diffs (44 lines):

diff -r 39df7d8082c4 -r 9ff3f4e85cee sys/dev/audio.c
--- a/sys/dev/audio.c   Mon May 15 10:59:24 2017 +0000
+++ b/sys/dev/audio.c   Mon May 15 12:07:32 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.348 2017/05/15 09:43:56 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.349 2017/05/15 12:07:32 martin 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.348 2017/05/15 09:43:56 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.349 2017/05/15 12:07:32 martin Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -4697,8 +4697,10 @@
        /* Play params can affect the record params, so recalculate blksize. */
        if (nr > 0 || np > 0 || reset) {
                vc->sc_blkset = false;
-               audio_calc_blksize(sc, AUMODE_RECORD, vc);
-               audio_calc_blksize(sc, AUMODE_PLAY, vc);
+               if (nr > 0)
+                       audio_calc_blksize(sc, AUMODE_RECORD, vc);
+               if (np > 0)
+                       audio_calc_blksize(sc, AUMODE_PLAY, vc);
        }
 #ifdef AUDIO_DEBUG
        if (audiodebug > 1 && nr > 0) {
@@ -4791,8 +4793,10 @@
                        cleared = true;
                }
                vc->sc_blkset = false;
-               audio_calc_blksize(sc, AUMODE_RECORD, vc);
-               audio_calc_blksize(sc, AUMODE_PLAY, vc);
+               if (nr > 0)
+                       audio_calc_blksize(sc, AUMODE_RECORD, vc);
+               if (np > 0)
+                       audio_calc_blksize(sc, AUMODE_PLAY, vc);
                sc->sc_pr.blksize = vc->sc_mpr.blksize;
                sc->sc_rr.blksize = vc->sc_mrr.blksize;
        } else {



Home | Main Index | Thread Index | Old Index