summaryrefslogtreecommitdiff
path: root/src/utils/pacat.c
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2010-02-11 23:33:19 +0000
committerColin Guthrie <cguthrie@mandriva.org>2010-02-11 23:33:19 +0000
commitff2091b2c47dfa7d9f1397627b72d9366b60f566 (patch)
tree70c0871ff6d1fc432ac0ba2b05191a6a74cf3c63 /src/utils/pacat.c
parent66cfa72eb4fd4669dfd7e465c07c41bb7e6d3d85 (diff)
downloadpulseaudio-panda-ff2091b2c47dfa7d9f1397627b72d9366b60f566.tar.gz
pulseaudio-panda-ff2091b2c47dfa7d9f1397627b72d9366b60f566.tar.bz2
pulseaudio-panda-ff2091b2c47dfa7d9f1397627b72d9366b60f566.zip
pacat: Don't use any buffer attr if we don't set any latency/process time params
Diffstat (limited to 'src/utils/pacat.c')
-rw-r--r--src/utils/pacat.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/utils/pacat.c b/src/utils/pacat.c
index 1036af65..68280e5e 100644
--- a/src/utils/pacat.c
+++ b/src/utils/pacat.c
@@ -409,6 +409,7 @@ static void context_state_callback(pa_context *c, void *userdata) {
case PA_CONTEXT_READY: {
pa_buffer_attr buffer_attr;
+ const pa_buffer_attr *active_buffer_attr = NULL;
pa_assert(c);
pa_assert(!stream);
@@ -438,29 +439,33 @@ static void context_state_callback(pa_context *c, void *userdata) {
if (latency_msec > 0) {
buffer_attr.fragsize = buffer_attr.tlength = pa_usec_to_bytes(latency_msec * PA_USEC_PER_MSEC, &sample_spec);
+ active_buffer_attr = &buffer_attr;
flags |= PA_STREAM_ADJUST_LATENCY;
} else if (latency > 0) {
buffer_attr.fragsize = buffer_attr.tlength = (uint32_t) latency;
+ active_buffer_attr = &buffer_attr;
flags |= PA_STREAM_ADJUST_LATENCY;
} else
buffer_attr.fragsize = buffer_attr.tlength = (uint32_t) -1;
if (process_time_msec > 0) {
buffer_attr.minreq = pa_usec_to_bytes(process_time_msec * PA_USEC_PER_MSEC, &sample_spec);
- } else if (process_time > 0)
+ active_buffer_attr = &buffer_attr;
+ } else if (process_time > 0) {
buffer_attr.minreq = (uint32_t) process_time;
- else
+ active_buffer_attr = &buffer_attr;
+ } else
buffer_attr.minreq = (uint32_t) -1;
if (mode == PLAYBACK) {
pa_cvolume cv;
- if (pa_stream_connect_playback(stream, device, &buffer_attr, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL) < 0) {
+ if (pa_stream_connect_playback(stream, device, active_buffer_attr, flags, volume_is_set ? pa_cvolume_set(&cv, sample_spec.channels, volume) : NULL, NULL) < 0) {
pa_log(_("pa_stream_connect_playback() failed: %s"), pa_strerror(pa_context_errno(c)));
goto fail;
}
} else {
- if (pa_stream_connect_record(stream, device, latency > 0 ? &buffer_attr : NULL, flags) < 0) {
+ if (pa_stream_connect_record(stream, device, active_buffer_attr, flags) < 0) {
pa_log(_("pa_stream_connect_record() failed: %s"), pa_strerror(pa_context_errno(c)));
goto fail;
}