mirror of https://github.com/mpv-player/mpv
b00eab525a
This helps with shitty APIs and even shittier drivers (I'm looking at you, ALSA). Sometimes they won't send proper wakeups. This can be fine during playback, when for example playing video, because mpv still will wakeup the AO outside of its own wakeup mechanisms when sending new data to it. But when draining, it entirely relies on the driver's wakeup mechanism. So when the driver wakeup mechanism didn't work, it could hard freeze while waiting for the audio thread to play the rest of the data. Avoid this by waiting for an upper bound. We set this upper bound at the total mpv audio buffer size plus 1 second. We don't use the get_delay value, because the audio API could return crap for it, and we're being paranoid here. I couldn't confirm whether this works correctly, because my driver issue fixed itself. (In the case that happened to me, the driver somehow stopped getting interrupts. aplay froze instead of playing audio, and playing audio-only files resulted in a chop party. Video worked, for reasons mentioned above, but drainign froze hard. The driver problem was solved when closing all audio output streams in the system. Might have been a dmix related problem too.) |
||
---|---|---|
.. | ||
decode | ||
filter | ||
out | ||
audio.c | ||
audio.h | ||
audio_buffer.c | ||
audio_buffer.h | ||
chmap.c | ||
chmap.h | ||
chmap_sel.c | ||
chmap_sel.h | ||
fmt-conversion.c | ||
fmt-conversion.h | ||
format.c | ||
format.h | ||
mixer.c | ||
mixer.h |