Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pad pad(4): run the callout if the buffer is saturat...



details:   https://anonhg.NetBSD.org/src/rev/6d1623db2b22
branches:  trunk
changeset: 1021604:6d1623db2b22
user:      nia <nia%NetBSD.org@localhost>
date:      Tue Jun 08 09:09:28 2021 +0000

description:
pad(4): run the callout if the buffer is saturated instead of returning

reverts to the same behavior as in -8 and -9. prevents immediate failures
and device timeouts if there's a slight delay in the buffer being
consumed.

this is reproducible with the example in the man page that uses
ffmpeg to record the output of audioplay:

$ ffmpeg -f s16le -ar 44100 -ac 2 -i /dev/pad0 output.wav
$ audioplay -d /dev/audio1 input.wav

if output.wav already exists, ffmpeg will prompt for confirmation
to overwrite as soon as audioplay starts, causing a noticable delay,
followed by a write failure that causes audioplay to immediately
exit.

diffstat:

 sys/dev/pad/pad.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 90b18daa0015 -r 6d1623db2b22 sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Mon Jun 07 22:13:34 2021 +0000
+++ b/sys/dev/pad/pad.c Tue Jun 08 09:09:28 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.65 2020/02/23 04:02:46 isaki Exp $ */
+/* $NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.65 2020/02/23 04:02:46 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.66 2021/06/08 09:09:28 nia Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -622,14 +622,12 @@
        err = pad_add_block(sc, block, blksize);
        mutex_exit(&sc->sc_cond_lock);
        cv_broadcast(&sc->sc_condvar);
-       if (err)
-               return err;
 
        ms = blksize * 1000 / PADCHAN / (PADPREC / NBBY) / PADFREQ;
        DPRINTF("%s: callout ms=%d\n", __func__, ms);
        callout_reset(&sc->sc_pcallout, mstohz(ms), pad_done_output, sc);
 
-       return 0;
+       return err;
 }
 
 static int



Home | Main Index | Thread Index | Old Index