summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-10-08 00:36:41 +0200
committerwm4 <wm4@nowhere>2020-10-08 00:36:41 +0200
commit6de25997a1c5eca4892ebdce492105d04feb436b (patch)
treedf931a86e7ef46e0e71af0a7bc154c5fb51e9852
parent4f18e7927bacd2e887f8cca48a967804ce7adf86 (diff)
downloadmpv-6de25997a1c5eca4892ebdce492105d04feb436b.tar.bz2
mpv-6de25997a1c5eca4892ebdce492105d04feb436b.tar.xz
player: fix another nightmarish corner case
Pretty much fuck this shit.
-rw-r--r--player/audio.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/player/audio.c b/player/audio.c
index f4175bc901..50c0faaf09 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -620,6 +620,17 @@ static void ao_process(struct mp_filter *f)
// This will eventually lead to the creation of the AO + queue, due
// to how f_output_chain and AO management works.
mp_pin_out_request_data(f->ppins[0]);
+ // Check for EOF with no data case, which is a mess because everything
+ // hates us.
+ struct mp_frame frame = mp_pin_out_read(f->ppins[0]);
+ if (frame.type == MP_FRAME_EOF) {
+ MP_VERBOSE(mpctx, "got EOF with no data before it\n");
+ ao_c->out_eof = true;
+ mpctx->audio_status = STATUS_DRAINING;
+ mp_wakeup_core(mpctx);
+ } else if (frame.type) {
+ mp_pin_out_unread(f->ppins[0], frame);
+ }
return;
}
@@ -918,11 +929,11 @@ void fill_audio_out_buffers(struct MPContext *mpctx)
mp_wakeup_core(mpctx);
}
- if (ao_c->ao && mpctx->audio_status == STATUS_DRAINING) {
+ if (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_is_playing(ao_c->ao) ||
- (opts->gapless_audio && !ao_untimed(ao_c->ao)))
+ if (!ao_c->ao || (!ao_is_playing(ao_c->ao) ||
+ (opts->gapless_audio && !ao_untimed(ao_c->ao))))
{
MP_VERBOSE(mpctx, "audio EOF reached\n");
mpctx->audio_status = STATUS_EOF;