demux: avoid some queue management corner cases with subtitles

Subtitle tracks are usually "lazy" (ds->eager=false), There are a number
of weird special cases associated with it. One of them is that they have
some sort of "temporary" EOF (to signal that there isn't a packet right
now, and the decoder should not block playback by waiting for more
packets). In a the next commit, I want to call mark_stream_eof() in case
of (some) of these temporary EOFs.

The problem is that mark_stream_eof() also calls the functions touched
by this commit. Basically they shouldn't do any complex work due to
these temporary EOFs (because they might happen very often). It turns
out that lazy tracks barely matter here: they do not extend the seek
range of a packet/EOF happens on them, they do not trigger seek range
joining, and they do not support backward demuxing.

This change should enable the following commit, while not causing any
behavior changes (i.e. bugs) with the current state.
This commit is contained in:
wm4 2020-02-27 02:15:21 +01:00
parent c43fd88f59
commit b873f1f8e5
1 changed files with 3 additions and 2 deletions

View File

@ -1569,7 +1569,7 @@ static void back_demux_see_packets(struct demux_stream *ds)
{
struct demux_internal *in = ds->in;
if (!ds->selected || !in->back_demuxing)
if (!ds->selected || !in->back_demuxing || !ds->eager)
return;
assert(!(ds->back_resuming && ds->back_restarting));
@ -1914,7 +1914,8 @@ static void adjust_seek_range_on_packet(struct demux_stream *ds,
queue->keyframe_latest = dp;
}
if (update_ranges) {
// Adding a sparse packet never changes the seek range.
if (update_ranges && ds->eager) {
update_seek_ranges(queue->range);
attempt_range_joining(ds->in);
}