summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_pulse.c
diff options
context:
space:
mode:
authorTom Yan <tom.ty89@gmail.com>2018-08-21 08:34:23 +0800
committersfan5 <sfan5@live.de>2018-09-01 16:14:11 +0200
commit9d6b15ab32d4c231574f392c193a53e865b2206d (patch)
treeb770e1d379041ebe8cbd6e2b1c6b4e2c0e9c81b6 /audio/out/ao_pulse.c
parent91786fa99c15dc64d3bce4be413326ba2dbe59f7 (diff)
downloadmpv-9d6b15ab32d4c231574f392c193a53e865b2206d.tar.bz2
mpv-9d6b15ab32d4c231574f392c193a53e865b2206d.tar.xz
ao_pulse: fix tlength calculation
also remove the now unused non-sensical af_fmt_seconds_to_bytes.
Diffstat (limited to 'audio/out/ao_pulse.c')
-rw-r--r--audio/out/ao_pulse.c6
1 files changed, 3 insertions, 3 deletions
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,