summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-06-02 17:08:52 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2008-06-02 17:08:52 +0000
commit83cadfb3c13260663876db66b0a132ea89daa53c (patch)
tree9f7699a357164aa73995e855ca3af4107c1dd382
parent1767596cfc7d7e2a1655ae142dedc13624da0508 (diff)
currently, we start the device as soon as write() blocks; it's better
to continue filling the play buffer until it's full. This way, the play buffer has fewer chances to underrun when the device is started. ok jakemsr
-rw-r--r--usr.bin/aucat/aucat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index 50d2143b0c4..c2bf3f44101 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.23 2008/06/02 17:08:11 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.24 2008/06/02 17:08:51 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -664,16 +664,17 @@ main(int argc, char **argv)
if (play != NULL) {
if (!quiet_flag)
fprintf(stderr, "filling buffers...\n");
+ buf = LIST_FIRST(&play->ibuflist);
while (!quit_flag) {
/* no more devices to poll */
if (!file_poll())
break;
- /* device is blocked */
- if (dev->events & POLLOUT)
- break;
/* eof */
if (dev->state & FILE_EOF)
break;
+ /* device is blocked and play buffer is full */
+ if ((dev->events & POLLOUT) && !ABUF_WOK(buf))
+ break;
}
}
if (!quiet_flag)