demux, f_decoder_wrapper: fix coverart in backward mode

Shitty ancient hack that wastes my time all the time.

demux.c: always return the coverart packet as soon as possible, and
don't let the backward demux state machine possibly stop it.

f_decoder_wrapper.c: mess with some shit until it somehow starts to
work. I think the old code tried to let it cleverly fall through so the
packet was processed "normally"; just make it run the "usual" code
instead.
This commit is contained in:
wm4 2019-05-25 21:57:31 +02:00
parent aaf4efd012
commit 2c3c6aae66
2 changed files with 17 additions and 13 deletions

View File

@ -2258,17 +2258,6 @@ static int dequeue_packet(struct demux_stream *ds, struct demux_packet **res)
if (in->blocked)
return 0;
if (ds->eager) {
in->reading = true; // enable readahead
in->eof = false; // force retry
pthread_cond_signal(&in->wakeup); // possibly read more
}
if (ds->back_resuming || ds->back_restarting) {
assert(in->back_demuxing);
return 0;
}
if (ds->sh->attached_picture) {
ds->eof = true;
if (ds->attached_picture_added)
@ -2282,6 +2271,17 @@ static int dequeue_packet(struct demux_stream *ds, struct demux_packet **res)
return 1;
}
if (ds->eager) {
in->reading = true; // enable readahead
in->eof = false; // force retry
pthread_cond_signal(&in->wakeup); // possibly read more
}
if (ds->back_resuming || ds->back_restarting) {
assert(in->back_demuxing);
return 0;
}
bool eof = !ds->reader_head && ds->eof;
if (in->back_demuxing) {

View File

@ -481,6 +481,9 @@ static void feed_packet(struct priv *p)
if (!p->decoder || !mp_pin_in_needs_data(p->decoder->f->pins[0]))
return;
if (p->decoded_coverart.type)
return;
if (!p->packet.type && !p->new_segment) {
p->packet = mp_pin_out_read(p->demux);
if (!p->packet.type)
@ -657,8 +660,9 @@ static void read_frame(struct priv *p)
return;
if (p->header->attached_picture && frame.type == MP_FRAME_VIDEO) {
p->decoded_coverart = mp_frame_ref(frame);
p->coverart_returned = 1;
p->decoded_coverart = frame;
mp_filter_internal_mark_progress(p->f);
return;
}
if (p->public.attempt_framedrops) {