Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Insert silence into the mix ring if there is no audi...



details:   https://anonhg.NetBSD.org/src/rev/54ff22d8d017
branches:  trunk
changeset: 352848:54ff22d8d017
user:      nat <nat%NetBSD.org@localhost>
date:      Wed Apr 12 14:15:50 2017 +0000

description:
Insert silence into the mix ring if there is no audio (or audio cannot
keep up) from the channels.

Addresses PR kern/34647.

diffstat:

 sys/dev/audio.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 285d2994ccd2 -r 54ff22d8d017 sys/dev/audio.c
--- a/sys/dev/audio.c   Wed Apr 12 10:35:10 2017 +0000
+++ b/sys/dev/audio.c   Wed Apr 12 14:15:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.321 2017/04/11 23:49:17 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.322 2017/04/12 14:15:50 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.321 2017/04/11 23:49:17 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.322 2017/04/12 14:15:50 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3789,9 +3789,13 @@
        if (sc->sc_saturate == true && sc->sc_opens > 1)
                saturate_func(sc);
 
+       vc = SIMPLEQ_FIRST(&sc->sc_audiochan)->vc;
        cb = &sc->sc_pr;
-       if (sc->sc_writeme == true)
-               cb->s.inp = audio_stream_add_inp(&cb->s, cb->s.inp, blksize);
+       inp = cb->s.inp;
+       cc = blksize - (inp - cb->s.start) % blksize;
+       if (sc->sc_writeme == false)
+               audio_pint_silence(sc, cb, inp, cc, vc);
+       cb->s.inp = audio_stream_add_inp(&cb->s, cb->s.inp, blksize);
        mutex_exit(sc->sc_intr_lock);
 
        kpreempt_disable();



Home | Main Index | Thread Index | Old Index