From e2798de952abe803a9e082bafbb5679fccb7effb Mon Sep 17 00:00:00 2001 From: nia Date: Tue, 8 Jun 2021 09:09:28 +0000 Subject: 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. --- sys/dev/pad/pad.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/pad/pad.c b/sys/dev/pad/pad.c index c7bee924b6f..4f4426c98c2 100644 --- a/sys/dev/pad/pad.c +++ b/sys/dev/pad/pad.c @@ -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 @@ -27,7 +27,7 @@ */ #include -__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 #include @@ -622,14 +622,12 @@ pad_start_output(void *opaque, void *block, int blksize, 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 -- cgit