1
mirror of https://github.com/mpv-player/mpv synced 2024-11-18 21:16:10 +01:00
mpv/audio
wm4 d842b017e4 audio/out: reduce amount of audio buffering
Since the addition of the AO feed thread, 200ms of latency (MIN_BUFFER)
was added to all push-based AOs. This is not so nice, because even AOs
with relatively small buffering (e.g. ao_alsa on my system with ~170ms
of buffer size), the additional latency becomes noticable when e.g.
toggling mute with softvol.

Fix this by trying to keep not only 200ms minimum buffer, but also 200ms
maximum buffer. In other words, never buffer beyond 200ms in total. Do
this by estimating the AO's buffer fill status using get_space and the
initially known AO buffer size (the get_space return value on
initialization, before any audio was played). We limit the maximum
amount of data written to the soft buffer so that soft buffer size and
audio buffer size equal to 200ms (MIN_BUFFER).

To avoid weird problems with weird AOs, we buffer beyond MIN_BUFFER if
the AO's get_space requests more data than that, and as long as the soft
buffer is large enough.

Note that this is just a hack to improve the latency. When the audio
chain gains the ability to refilter data, this won't be needed anymore,
and instead we can introduce some sort of buffer replacement function in
order to update data in the soft buffer.
2014-03-10 01:13:40 +01:00
..
decode Factor out setting AVCodecContext extradata 2014-01-11 01:25:49 +01:00
filter audio/filter: remove redundant log message prefixes 2014-01-24 21:30:15 +01:00
out audio/out: reduce amount of audio buffering 2014-03-10 01:13:40 +01:00
audio_buffer.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
audio_buffer.h audio: add mp_audio_buffer 2013-11-12 23:28:21 +01:00
audio.c audio: check for overflows 2014-01-03 00:42:40 +01:00
audio.h audio: better rejection of invalid formats 2013-11-27 00:16:05 +01:00
chmap_sel.c ao_jack: allow more control about channel layouts 2013-07-07 18:37:55 +02:00
chmap_sel.h audio: add channel map selection function 2013-05-12 21:24:57 +02:00
chmap.c m_option, m_config: mp_msg conversions 2013-12-21 21:05:02 +01:00
chmap.h audio: add enum name for speaker id 2014-02-28 20:54:15 +01:00
fmt-conversion.c audio: fix format ID conversion 2013-12-23 21:24:41 +01:00
fmt-conversion.h ad_lavc: use fmt-conversion to map sample formats 2013-04-13 04:21:27 +02:00
format.c Split mpvcore/ into common/, misc/, bstr/ 2013-12-17 02:39:45 +01:00
format.h audio: fix signedness of AF_FORMAT_S32P 2014-02-05 18:53:00 +01:00
mixer.c audio/out: feed AOs from a separate thread 2014-03-09 01:27:41 +01:00
mixer.h command: use the step size for "add volume" commands 2014-02-27 01:07:46 +01:00
reorder_ch.c ao_lavc: support non-interleaved audio 2013-11-13 20:10:17 +01:00
reorder_ch.h ao_lavc: support non-interleaved audio 2013-11-13 20:10:17 +01:00