[pulseaudio-discuss] [PATCH 2/2] pacat: write as much as possible in one go

Tanu Kaskinen tanuk at iki.fi
Wed Dec 28 14:09:55 UTC 2016


Previously pacat wrote at most pa_stream_writable_size() bytes at a
time, now with this patch it can write more than that if there's more
input data available. Writing in bigger chunks is potentially a bit more
efficient.
---
 src/utils/pacat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 4e1bbfc..5a000ae 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -525,7 +525,7 @@ fail:
 /* New data on STDIN **/
 static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) {
     uint8_t *buf = NULL;
-    size_t writable, towrite, r;
+    size_t writable = (size_t) -1, towrite, r;
 
     pa_assert(a == mainloop_api);
     pa_assert(e);
@@ -533,7 +533,7 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
 
     /* Stream not ready? */
     if (!stream || pa_stream_get_state(stream) != PA_STREAM_READY ||
-        !(writable = pa_stream_writable_size(stream))) {
+        !(pa_stream_writable_size(stream))) {
 
         mainloop_api->io_enable(stdio_event, PA_IO_EVENT_NULL);
         return;
-- 
2.10.2



More information about the pulseaudio-discuss mailing list