diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-09-17 01:22:48 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-09-17 01:22:48 +0200 |
commit | 1a6974a1e2f013e6ae522bc404adf24724f3127b (patch) | |
tree | 87c8246ef0ca296e7f7ab96fae1c8a7bf2518a1a | |
parent | e2899f8bf331d4cc89e2fa4ef3d17924fb91f922 (diff) |
pacat: use fully automatic buffer sizes if possible
-rw-r--r-- | src/utils/pacat.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/utils/pacat.c b/src/utils/pacat.c index 781bfa33..5f29ba39 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -430,14 +430,18 @@ static void context_state_callback(pa_context *c, void *userdata) { pa_stream_set_event_callback(stream, stream_event_callback, NULL); pa_stream_set_buffer_attr_callback(stream, stream_buffer_attr_callback, NULL); + pa_zero(buffer_attr); + buffer_attr.maxlength = (uint32_t) -1; + buffer_attr.prebuf = (uint32_t) -1; + if (latency > 0) { - memset(&buffer_attr, 0, sizeof(buffer_attr)); - buffer_attr.tlength = (uint32_t) latency; + buffer_attr.fragsize = buffer_attr.tlength = (uint32_t) latency; buffer_attr.minreq = (uint32_t) process_time; - buffer_attr.maxlength = (uint32_t) -1; - buffer_attr.prebuf = (uint32_t) -1; - buffer_attr.fragsize = (uint32_t) latency; flags |= PA_STREAM_ADJUST_LATENCY; + } else { + buffer_attr.tlength = (uint32_t) -1; + buffer_attr.minreq = (uint32_t) -1; + buffer_attr.fragsize = (uint32_t) -1; } if (mode == PLAYBACK) { |