summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-08-27 18:40:12 +0200
committerwm4 <wm4@nowhere>2020-08-27 18:40:12 +0200
commit47a5f868291349746caa681799fa0d332a6ceabf (patch)
treed4cbc4c0110c8a16699df38d832d3c9ed8bf6058
parentab6dbf0a294d695449b46c6ac1e5603fd9a8a8e7 (diff)
downloadmpv-47a5f868291349746caa681799fa0d332a6ceabf.tar.bz2
mpv-47a5f868291349746caa681799fa0d332a6ceabf.tar.xz
f_decoder_wrapper: pass through EOF after EOF
It's relevant in some obscure corner cases (EDL file that has a segment without audio). Didn't test what's actually going on (is ad_lavc.c behaving wrong? is libavcodec behaving wrong or in an unexpected way? is lavc_process wrong?) and just patched it over with some bullshit, so the fix might be too complicated, and could be reworked at some later point. This sure is a real data flow fuckmess.
-rw-r--r--filters/f_decoder_wrapper.c7
-rw-r--r--filters/f_decoder_wrapper.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/filters/f_decoder_wrapper.c b/filters/f_decoder_wrapper.c
index 3f7fe50aad..31fb2997f0 100644
--- a/filters/f_decoder_wrapper.c
+++ b/filters/f_decoder_wrapper.c
@@ -1266,6 +1266,7 @@ void lavc_process(struct mp_filter *f, struct lavc_state *state,
if (!state->eof_returned)
mp_pin_in_write(f->ppins[1], MP_EOF_FRAME);
state->eof_returned = true;
+ state->packets_sent = false;
} else if (ret_recv == AVERROR(EAGAIN)) {
// Need to feed a packet.
frame = mp_pin_out_read(f->ppins[0]);
@@ -1279,6 +1280,11 @@ void lavc_process(struct mp_filter *f, struct lavc_state *state,
mp_filter_internal_mark_failed(f);
}
return;
+ } else if (!state->packets_sent) {
+ // EOF only; just return it, without requiring send/receive to
+ // pass it through properly.
+ mp_pin_in_write(f->ppins[1], MP_EOF_FRAME);
+ return;
}
int ret_send = send(f, pkt);
if (ret_send == AVERROR(EAGAIN)) {
@@ -1288,6 +1294,7 @@ void lavc_process(struct mp_filter *f, struct lavc_state *state,
mp_filter_wakeup(f);
return;
}
+ state->packets_sent = true;
talloc_free(pkt);
mp_filter_internal_mark_progress(f);
} else {
diff --git a/filters/f_decoder_wrapper.h b/filters/f_decoder_wrapper.h
index 51badaaabd..e6f7705b33 100644
--- a/filters/f_decoder_wrapper.h
+++ b/filters/f_decoder_wrapper.h
@@ -110,6 +110,7 @@ extern const struct mp_decoder_fns ad_spdif;
// init to all-0 on init and resets.
struct lavc_state {
bool eof_returned;
+ bool packets_sent;
};
void lavc_process(struct mp_filter *f, struct lavc_state *state,
int (*send)(struct mp_filter *f, struct demux_packet *pkt),