summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-29 02:30:04 +0200
committerwm4 <wm4@nowhere>2019-09-29 02:36:02 +0200
commiteb3aed7cf8be8d13aca65f19c5b0aff1ecd868fc (patch)
treec6449780efd8ff895fdeeeac647d577e934b5b92 /player/loadfile.c
parent3b13a4799314fba316bcd4e7abce2685415c262b (diff)
downloadmpv-eb3aed7cf8be8d13aca65f19c5b0aff1ecd868fc.tar.bz2
mpv-eb3aed7cf8be8d13aca65f19c5b0aff1ecd868fc.tar.xz
loadfile: make prefetching actually work
Looks like this didn't actually work. Prefetching will do nothing if there isn't a thread to "drive" it, and the demuxer thread needs to be explicitly enabled. (I guess I did the worst possible job in verifying whether this actually worked when I implemented it. On the other hand, the user didn't confirm back whether it worked, so who cares.) Like in the previous commit, bad factoring makes everything worse. It duplicates logic and implementation of enable_demux_thread(), since the opener thread cannot access the mpctx->opts field freely. But it's deep night, so fuck it. Fixes: c1f1a0845e03885e Fixes: #6753
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 70fe0e42a7..8ba54d1e6f 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -990,6 +990,8 @@ static void *open_demux_thread(void *ctx)
demuxer_select_track(demux, sh, MP_NOPTS_VALUE, true);
}
+ demux_set_wakeup_cb(demux, wakeup_demux, mpctx);
+ demux_start_thread(demux);
demux_start_prefetch(demux);
}
} else {
@@ -1042,7 +1044,7 @@ static void start_open(struct MPContext *mpctx, char *url, int url_flags,
mpctx->open_url = talloc_strdup(NULL, url);
mpctx->open_format = talloc_strdup(NULL, mpctx->opts->demuxer_name);
mpctx->open_url_flags = url_flags;
- mpctx->open_for_prefetch = for_prefetch;
+ mpctx->open_for_prefetch = for_prefetch && mpctx->opts->demuxer_thread;
if (mpctx->opts->load_unsafe_playlists)
mpctx->open_url_flags = 0;