From ad9e473c555861033998fd5d6c326fdd1bc7db32 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 31 May 2019 22:13:47 +0200 Subject: [PATCH] demux: remove some old/ineffective backward restart code Commit 4544fb085 added this, but commit 7165ebd0b made it dead code. At least from what I can see. The check for back_restart_next in find_backward_restart_pos() now decides whether to use this EOF special code. Since the backward playback start state also sets this variable, we don't need the code in dequeue_packet() anymore either. --- demux/demux.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/demux/demux.c b/demux/demux.c index 2ea4a95d67..3560ca4737 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1495,17 +1495,9 @@ static void step_backwards(struct demux_stream *ds) assert(!ds->back_restarting); ds->back_restarting = true; - + ds->back_restart_eof = false; ds->back_restart_next = false; - // No valid restart pos, but EOF reached -> find last restart pos before EOF. - ds->back_restart_eof = ds->back_restart_dts == MP_NOPTS_VALUE && - ds->back_restart_pos < 0 && - ds->eof; - - if (ds->back_restart_eof) - MP_VERBOSE(in, "backward eof on stream %d\n", ds->index); - // Move to start of queue. This is inefficient, because we need to iterate // the entire fucking packet queue just to update the fw_* stats. But as // long as we don't have demux_packet.prev links or a complete index, it's @@ -2291,10 +2283,8 @@ static int dequeue_packet(struct demux_stream *ds, struct demux_packet **res) return -1; // Next keyframe (or EOF) was reached => step back. - if ((ds->back_range_started && !ds->back_range_min && - ((ds->reader_head && ds->reader_head->keyframe) || eof)) || - (!ds->back_range_started && !ds->back_range_min && - !ds->reader_head && eof)) + if (ds->back_range_started && !ds->back_range_min && + ((ds->reader_head && ds->reader_head->keyframe) || eof)) { step_backwards(ds); if (ds->back_restarting)