From 3497c8074c724b7837541ff0cb209bc8e6220575 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 28 Aug 2009 03:58:29 +0200 Subject: pulse: relax latency requirements as much as possible to save CPU --- src/pulse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/pulse.c') diff --git a/src/pulse.c b/src/pulse.c index 2283b68..3069112 100644 --- a/src/pulse.c +++ b/src/pulse.c @@ -804,6 +804,7 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal int ret; pa_operation *o; char *sp; + pa_buffer_attr ba; ca_return_val_if_fail(c, CA_ERROR_INVALID); ca_return_val_if_fail(proplist, CA_ERROR_INVALID); @@ -999,7 +1000,15 @@ int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist, ca_finish_cal if (volume_set) pa_cvolume_set(&cvol, ss.channels, v); - if (pa_stream_connect_playback(out->stream, NULL, NULL, + /* Make sure we get the longest latency possible, to minimize CPU + * consumption */ + ba.maxlength = (uint32_t) -1; + ba.tlength = (uint32_t) -1; + ba.prebuf = (uint32_t) -1; + ba.minreq = (uint32_t) -1; + ba.fragsize = (uint32_t) -1; + + if (pa_stream_connect_playback(out->stream, NULL, &ba, #ifdef PA_STREAM_FAIL_ON_SUSPEND PA_STREAM_FAIL_ON_SUSPEND #else -- cgit