summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-10 00:41:37 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:19 +0900
commit38903486fb9f3f5707e33f33aff0363cea5be3b3 (patch)
tree9946a8b6731d7074039ec72f88e372acedabda47
parentc56b237b3c20d22826920616bf70a1713812d3cc (diff)
downloadmpv-38903486fb9f3f5707e33f33aff0363cea5be3b3.tar.bz2
mpv-38903486fb9f3f5707e33f33aff0363cea5be3b3.tar.xz
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.
-rw-r--r--player/loadfile.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index ec213c96c8..701347f443 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -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);
+ }
+ }
}
}