summaryrefslogtreecommitdiff
path: root/sys/dev/pad
diff options
context:
space:
mode:
authornia <nia@NetBSD.org>2021-06-08 09:09:28 +0000
committernia <nia@NetBSD.org>2021-06-08 09:09:28 +0000
commite2798de952abe803a9e082bafbb5679fccb7effb (patch)
treecd86ec2c59b0118fc50045c1fa014202499b87b3 /sys/dev/pad
parent6dcbc416d2b056afc4b2cf5d6447ff5505abf943 (diff)
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 (limited to 'sys/dev/pad')
-rw-r--r--sys/dev/pad/pad.c8
1 files changed, 3 insertions, 5 deletions
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 <jmcneill@invisible.ca>
@@ -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 @@ 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