diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-08-28 03:58:29 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-08-28 03:58:29 +0200 |
commit | 3497c8074c724b7837541ff0cb209bc8e6220575 (patch) | |
tree | b314d7c4d7cbc5beb2c2027093af559c947c3e61 | |
parent | da943991f05c18a975a45430d8042fec3457ba4c (diff) | |
download | libcanberra-3497c8074c724b7837541ff0cb209bc8e6220575.tar.gz |
pulse: relax latency requirements as much as possible to save CPU
-rw-r--r-- | src/pulse.c | 11 |
1 files changed, 10 insertions, 1 deletions
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 |