diff options
author | wm4 <wm4@nowhere> | 2016-02-16 21:05:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-02-16 21:05:18 +0100 |
commit | 3c3cd0c540a1ecd11b6a2d633b8e4c963802386d (patch) | |
tree | 7220c2e6aa542d57d2ae2e4b9975967098fe619c /demux/demux_timeline.c | |
parent | 0af5335383887cda7650d4b33bc42759c1a5891f (diff) | |
download | mpv-3c3cd0c540a1ecd11b6a2d633b8e4c963802386d.tar.bz2 mpv-3c3cd0c540a1ecd11b6a2d633b8e4c963802386d.tar.xz |
demux_timeline: disable cache for inactive segments
This is achieved indirectly by deslecting all streams for the non-
current segment (and if the segment doesn't share the demuxer with the
currently active one).
Restores functionality added with commit 46bcdb70.
Diffstat (limited to 'demux/demux_timeline.c')
-rw-r--r-- | demux/demux_timeline.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index 9dbbff2158..ef6e5a3890 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -25,6 +25,8 @@ #include "timeline.h" #include "stheader.h" +static void reselect_streams(struct demuxer *demuxer); + struct segment { int index; double start, end; @@ -81,6 +83,7 @@ static void switch_segment(struct demuxer *demuxer, struct segment *new, MP_VERBOSE(demuxer, "switch to segment %d\n", new->index); p->current = new; + reselect_streams(demuxer); demux_set_ts_offset(new->d, new->start - new->d_start); demux_seek(new->d, start_pts, flags | SEEK_ABSOLUTE); @@ -333,6 +336,8 @@ static int d_open(struct demuxer *demuxer, enum demux_check check) demuxer->seekable = true; demuxer->partially_seekable = true; + reselect_streams(demuxer); + return 0; } @@ -360,6 +365,9 @@ static void reselect_streams(struct demuxer *demuxer) bool selected = false; if (seg->stream_map[i] >= 0) selected = p->streams[seg->stream_map[i]].selected; + // This stops demuxer readahead for inactive segments. + if (!p->current || seg->d != p->current->d) + selected = false; demuxer_select_track(seg->d, sh, selected); } } |