audio: avoid missed wakeups with ab-loops

Could get "stuck".
This commit is contained in:
wm4 2016-08-24 12:14:48 +02:00
parent c218d9e960
commit c4ba600832
1 changed files with 5 additions and 1 deletions

View File

@ -862,6 +862,7 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;
struct ao_chain *ao_c = mpctx->ao_chain;
bool was_eof = mpctx->audio_status == STATUS_EOF;
dump_audio_stats(mpctx);
@ -1082,8 +1083,11 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
mpctx->audio_status = STATUS_DRAINING;
// Wait until the AO has played all queued data. In the gapless case,
// we trigger EOF immediately, and let it play asynchronously.
if (ao_eof_reached(mpctx->ao) || opts->gapless_audio)
if (ao_eof_reached(mpctx->ao) || opts->gapless_audio) {
mpctx->audio_status = STATUS_EOF;
if (!was_eof)
mpctx->sleeptime = 0;
}
}
}