1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-19 14:26:57 +00:00

player: enable demuxer thread for external audio files

Enable asynchronous reading for external files. This excludes subtitle
files (so it's effectively enabled for audio files only), because most
subtitle files are fully read on loading, and running a thread for them
would just cause slowdowns and increase resource usage, without having
any advantages.

In theory, an external file could provide multiple tracks from the same
demuxer, but demux_start_thread() is idempotent, so the code can be
kept simple.

Should help with playing DASH with ytdl_hook.
This commit is contained in:
wm4 2015-01-10 00:41:37 +01:00 committed by Diogo Franco (Kovensky)
parent c56b237b3c
commit 38903486fb

View File

@ -241,6 +241,15 @@ static void enable_demux_thread(struct MPContext *mpctx)
if (mpctx->demuxer && mpctx->opts->demuxer_thread) {
demux_set_wakeup_cb(mpctx->demuxer, wakeup_demux, mpctx);
demux_start_thread(mpctx->demuxer);
for (int n = 0; n < mpctx->num_tracks; n++) {
struct track *track = mpctx->tracks[n];
if (track->is_external && track->stream &&
track->stream->type != STREAM_SUB)
{
demux_set_wakeup_cb(track->demuxer, wakeup_demux, mpctx);
demux_start_thread(track->demuxer);
}
}
}
}