From f2ff4527eb137f5b539c34b85198e28ac4547bdd Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 16 May 2019 16:56:43 +0200 Subject: [PATCH] demux: don't process obscure skipped packets When doing a seek to the end of the cache, ds->skip_to_keyframe can be set to true. Then some packets passed to add_packet_locked() may have to be skipped. In some aspects, the skipped packet was still treated as if it was going to be returned to the reader. It almost doesn't matter though: it only caused a redundant wakeup_ds() call, and could pass the packet to the stream recorder. Fix it anyway. --- demux/demux.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/demux/demux.c b/demux/demux.c index bb60186faf..9b264b7123 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -1515,6 +1515,11 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp) } } + // Don't process the packet further if it's skipped by the previous seek + // (see reader_head check/assignment above). + if (!ds->reader_head) + return; + // (should preferably be outside of the lock) if (in->enable_recording && !in->recorder && in->opts->record_file && in->opts->record_file[0])