summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-10-24 09:35:17 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-10-24 09:35:17 +0000
commit593d1651ef4c42769036980a070d6a01e7897bf4 (patch)
tree596efa889b3e64b1f2fb8cbe815a3d65da147f42 /lib
parent244c524c3c2585412e3789a626252291f411e837 (diff)
Flow control blocks the client in sio_write(3). Split the data
stream in a way that the pause never occurs in the middle of data chunks. Beside being more natural, this allows the client to send non-data messages during the pause (set the volume, stop playback...), rather than delaying them until the end of the pause. It's about few milliseconds only.
Diffstat (limited to 'lib')
-rw-r--r--lib/libsndio/aucat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index 681411700de..272df65d246 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.30 2009/10/22 21:41:30 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.31 2009/10/24 09:35:16 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -546,8 +546,12 @@ aucat_buildmsg(struct aucat_hdl *hdl, size_t len)
hdl->wmsg.u.vol.ctl = hdl->reqvol;
hdl->curvol = hdl->reqvol;
return 1;
- } else if (len > 0) {
- sz = (len < AMSG_DATAMAX) ? len : AMSG_DATAMAX;
+ } else if (len > 0 && hdl->maxwrite > 0) {
+ sz = len;
+ if (sz > AMSG_DATAMAX)
+ sz = AMSG_DATAMAX;
+ if (sz > hdl->maxwrite)
+ sz = hdl->maxwrite;
sz -= sz % hdl->wbpf;
if (sz == 0)
sz = hdl->wbpf;