summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-02-27 02:15:21 +0100
committerwm4 <wm4@nowhere>2020-02-27 02:15:21 +0100
commitb873f1f8e5a0d34defe4c7b975ec584377c731ac (patch)
treea57683b98a0c8f2df318bfb2c4f1771e05c2d8c8
parentc43fd88f5997821251bdeeca9700fa18c42049df (diff)
downloadmpv-b873f1f8e5a0d34defe4c7b975ec584377c731ac.tar.bz2
mpv-b873f1f8e5a0d34defe4c7b975ec584377c731ac.tar.xz
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.
-rw-r--r--demux/demux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/demux/demux.c b/demux/demux.c
index cf54df5e96..6b5123d49a 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -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);
}