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: c1f1a0845e
Fixes: #6753
This commit is contained in:
wm4 2019-09-29 02:30:04 +02:00
parent 3b13a47993
commit eb3aed7cf8
1 changed files with 3 additions and 1 deletions

View File

@ -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;