From 3a5cbf39072fd07f457560f25899dda442246b20 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 2 Oct 2016 13:47:19 +0200 Subject: 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). --- player/audio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'player/audio.c') 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 } -- cgit v1.2.3