summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-02 13:47:19 +0200
committerwm4 <wm4@nowhere>2016-10-02 13:47:25 +0200
commit3a5cbf39072fd07f457560f25899dda442246b20 (patch)
tree505c1c4c7069d02abdffbf51e994206c977251ad /player/audio.c
parent6f4d918cb7a500ff354e13cf6f83c53799d3cc24 (diff)
downloadmpv-3a5cbf39072fd07f457560f25899dda442246b20.tar.bz2
mpv-3a5cbf39072fd07f457560f25899dda442246b20.tar.xz
audio: fix late audio start
Regression since commit bbcd0b6a. This code is just cursed, because it's a fragile state machine with no proper tests, and which could be done in a much simpler way. Without doubt this change will cause a regression in some ridiculous corner case as well. Fixes #3610 (the cause of it, not the behavior it resulted in).
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/player/audio.c b/player/audio.c
index ca80518f23..29ad44e5ed 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -988,7 +988,9 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
// If EOF was reached before, but now something can be decoded, try to
// restart audio properly. This helps with video files where audio starts
// later. Retrying is needed to get the correct sync PTS.
- if (mpctx->audio_status >= STATUS_DRAINING && status == AD_OK) {
+ if (mpctx->audio_status >= STATUS_DRAINING &&
+ mp_audio_buffer_samples(ao_c->ao_buffer) > 0)
+ {
mpctx->audio_status = STATUS_SYNCING;
return; // retry on next iteration
}