Module Name:    src
Committed By:   nia
Date:           Tue Jun  8 09:09:29 UTC 2021

Modified Files:
        src/sys/dev/pad: pad.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pad/pad.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.65 src/sys/dev/pad/pad.c:1.66
--- src/sys/dev/pad/pad.c:1.65	Sun Feb 23 04:02:46 2020
+++ src/sys/dev/pad/pad.c	Tue Jun  8 09:09:28 2021
@@ -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 <jmcne...@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 *blo
 	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

Reply via email to