From a220a3aae6975d1a6c5e0b1325ee07040b0f701b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 7 Jan 2014 23:50:22 +0100 Subject: ao_pulse: add suboption to control buffer size --- audio/out/ao_pulse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'audio/out/ao_pulse.c') diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index f3bce40574..a573738deb 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -23,6 +23,7 @@ #include #include #include +#include #include @@ -55,6 +56,7 @@ struct priv { char *cfg_host; char *cfg_sink; + int cfg_buffer; }; #define GENERIC_ERR_MSG(str) \ @@ -328,7 +330,8 @@ static int init(struct ao *ao) stream_latency_update_cb, ao); pa_buffer_attr bufattr = { .maxlength = -1, - .tlength = pa_usec_to_bytes(1000000, &ss), + .tlength = priv->cfg_buffer > 0 ? + pa_usec_to_bytes(priv->cfg_buffer * 1000, &ss) : (uint32_t)-1, .prebuf = -1, .minreq = -1, .fragsize = -1, @@ -617,9 +620,13 @@ const struct ao_driver audio_out_pulse = { .pause = pause, .resume = resume, .priv_size = sizeof(struct priv), + .priv_defaults = &(const struct priv) { + .cfg_buffer = 1000, + }, .options = (const struct m_option[]) { OPT_STRING("host", cfg_host, 0), OPT_STRING("sink", cfg_sink, 0), + OPT_CHOICE_OR_INT("buffer", cfg_buffer, 0, 1, 2000, ({"native", -1})), {0} }, }; -- cgit v1.2.3