From e8147843fc072c5056d99b6c162216d82f1eedc7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 7 Jun 2019 17:09:22 +0200 Subject: demux: really disable cache for sub-demuxers It seems the so called demuxer cache wasn't really disabled for sub-demuxers (timeline stuff). This was relatively harmless, since the actual packet data was shared anyway via refcounting. But with the addition of a mmap cache backend, this may change a lot. So strictly disable any caching for sub-demuxers. This assumes that users of sub-demuxers (only demux_timeline.c by now?) strictly use demux_read_any_packet(), since demux_read_packet_async() will require some minor read-ahead if a low level packet read returned a packet for a different stream. This requires some awkward messing with this fucking heap of trash. The thing that is really wrong here is that the demuxer API mixes different concepts, and sub-demuxers get the same API as decoders, and use the cache code. --- player/loadfile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'player/loadfile.c') diff --git a/player/loadfile.c b/player/loadfile.c index c730d2e8f8..69cccb2c5c 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -724,7 +724,9 @@ int mp_add_external_file(struct MPContext *mpctx, char *filename, if (strncmp(disp_filename, "memory://", 9) == 0) disp_filename = "memory://"; // avoid noise - struct demuxer_params params = {0}; + struct demuxer_params params = { + .is_top_level = true, + }; switch (filter) { case STREAM_SUB: @@ -968,6 +970,7 @@ static void *open_demux_thread(void *ctx) .force_format = mpctx->open_format, .stream_flags = mpctx->open_url_flags, .stream_record = true, + .is_top_level = true, }; mpctx->open_res_demuxer = demux_open_url(mpctx->open_url, &p, mpctx->open_cancel, mpctx->global); -- cgit v1.2.3