summaryrefslogtreecommitdiffstats
path: root/demux/demux_timeline.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-06-08 20:32:15 +0200
committerwm4 <wm4@nowhere>2019-09-19 20:37:05 +0200
commitfae31f39c7c2a8d71b101680e4fa99400ea06a16 (patch)
treed609156782e0d7358ee15122dd1fbc62971c6c95 /demux/demux_timeline.c
parente8147843fc072c5056d99b6c162216d82f1eedc7 (diff)
downloadmpv-fae31f39c7c2a8d71b101680e4fa99400ea06a16.tar.bz2
mpv-fae31f39c7c2a8d71b101680e4fa99400ea06a16.tar.xz
demux: refactor cache range init/deinit
Remove the duplicated creation of the first range. Explicitly destroy ranges, including the last one on final deinit. It looks like this also fixes a leak of removed range structs, which was never noticed because they're so small, and were freed on final deinit due to having the demuxer as talloc parent. This improves upon the previous commit too (that change should have been part of it I guess). Sub-demuxers (demux_timeline only) now automatically don't use the cache (like it was intended by the previous commit). The cache is "initialized" (or disabled) last in the recursive call chain, which is messy, but this sub demuxer stuff FUCKING SUCKS, as mentioned in the previous commit message. This would be no problem if the caching layer and actual demuxer implementations were separate. Most of this change has no purpose. Might make (de-)initialization of further cache exerpiments simpler.
Diffstat (limited to 'demux/demux_timeline.c')
-rw-r--r--demux/demux_timeline.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c
index 82760582b5..8237a69a0f 100644
--- a/demux/demux_timeline.c
+++ b/demux/demux_timeline.c
@@ -217,10 +217,8 @@ static void reopen_lazy_segments(struct demuxer *demuxer,
demuxer->cancel, demuxer->global);
if (!src->current->d && !demux_cancel_test(demuxer))
MP_ERR(demuxer, "failed to load segment\n");
- if (src->current->d) {
- demux_disable_cache(src->current->d);
+ if (src->current->d)
update_slave_stats(demuxer, src->current->d);
- }
associate_streams(demuxer, src, src->current);
}
@@ -593,10 +591,8 @@ static bool add_tl(struct demuxer *demuxer, struct timeline_par *tl)
// demux_timeline already does caching, doing it for the sub-demuxers
// would be pointless and wasteful.
- if (part->source) {
- demux_disable_cache(part->source);
+ if (part->source)
demuxer->is_network |= part->source->is_network;
- }
struct segment *seg = talloc_ptrtype(src, seg);
*seg = (struct segment){