Source-Changes-HG archive

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

[src/trunk]: src/sys/dev If there is no data in the mix ring, insert silence.



details:   https://anonhg.NetBSD.org/src/rev/a530c5a060b2
branches:  trunk
changeset: 823414:a530c5a060b2
user:      nat <nat%NetBSD.org@localhost>
date:      Sat Apr 22 10:37:51 2017 +0000

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

This will ensure that the hardware output pointer remains valid.

diffstat:

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

diffs (39 lines):

diff -r 2c394a803d84 -r a530c5a060b2 sys/dev/audio.c
--- a/sys/dev/audio.c   Sat Apr 22 07:48:33 2017 +0000
+++ b/sys/dev/audio.c   Sat Apr 22 10:37:51 2017 +0000
@@ -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 <nathanialsloss%yahoo.com.au@localhost>
@@ -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 @@
                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:



Home | Main Index | Thread Index | Old Index