mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
loadfile: restore playlist prefetching
With the stream cache gone, this function had almost no use anymore (other than opening the stream). Improve this by triggering demuxer cache readahead. This enables all streams. At this point we can't know yet what streams the user's options would select (at least not without great additional effort). Generally this is what you want, and the stream cache would have read the same amount of data. In addition, this will work much better for files that e.g. need to seek to the end when opening (typically mp4, and mkv files produced by newer mkvmerge versions). Remove the deselection call from add_stream_track(). This should be fine, as streams normally start out as deselected anyway. In the prefetch case, some code in play_current_file() actually deselects it. Streams that appear during demuxing are disabled by default, so this doesn't break this logic either. Fixes: #6753
This commit is contained in:
parent
94bfe83355
commit
c1f1a0845e
@ -422,8 +422,6 @@ static struct track *add_stream_track(struct MPContext *mpctx,
|
||||
};
|
||||
MP_TARRAY_APPEND(mpctx, mpctx->tracks, mpctx->num_tracks, track);
|
||||
|
||||
demuxer_select_track(track->demuxer, stream, MP_NOPTS_VALUE, false);
|
||||
|
||||
mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL);
|
||||
|
||||
return track;
|
||||
@ -974,11 +972,20 @@ static void *open_demux_thread(void *ctx)
|
||||
.stream_record = true,
|
||||
.is_top_level = true,
|
||||
};
|
||||
mpctx->open_res_demuxer =
|
||||
struct demuxer *demux =
|
||||
demux_open_url(mpctx->open_url, &p, mpctx->open_cancel, mpctx->global);
|
||||
mpctx->open_res_demuxer = demux;
|
||||
|
||||
if (mpctx->open_res_demuxer) {
|
||||
if (demux) {
|
||||
MP_VERBOSE(mpctx, "Opening done: %s\n", mpctx->open_url);
|
||||
|
||||
int num_streams = demux_get_num_stream(demux);
|
||||
for (int n = 0; n < num_streams; n++) {
|
||||
struct sh_stream *sh = demux_get_stream(demux, n);
|
||||
demuxer_select_track(demux, sh, MP_NOPTS_VALUE, true);
|
||||
}
|
||||
|
||||
demux_start_prefetch(demux);
|
||||
} else {
|
||||
MP_VERBOSE(mpctx, "Opening failed or was aborted: %s\n", mpctx->open_url);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user