From 9d6b15ab32d4c231574f392c193a53e865b2206d Mon Sep 17 00:00:00 2001 From: Tom Yan Date: Tue, 21 Aug 2018 08:34:23 +0800 Subject: ao_pulse: fix tlength calculation also remove the now unused non-sensical af_fmt_seconds_to_bytes. --- audio/out/ao_pulse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'audio/out/ao_pulse.c') diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index ed45ba6549..e288841788 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -454,11 +454,11 @@ static int init(struct ao *ao) pa_stream_set_write_callback(priv->stream, stream_request_cb, ao); pa_stream_set_latency_update_callback(priv->stream, stream_latency_update_cb, ao); - int buf_size = af_fmt_seconds_to_bytes(ao->format, priv->cfg_buffer / 1000.0, - ao->channels.num, ao->samplerate); + uint32_t buf_size = ao->samplerate * (priv->cfg_buffer / 1000.0) * + af_fmt_to_bytes(ao->format) * ao->channels.num; pa_buffer_attr bufattr = { .maxlength = -1, - .tlength = buf_size > 0 ? buf_size : (uint32_t)-1, + .tlength = buf_size > 0 ? buf_size : -1, .prebuf = -1, .minreq = -1, .fragsize = -1, -- cgit v1.2.3