summaryrefslogtreecommitdiffstats
path: root/player/playloop.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-03 21:48:42 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-03 15:43:51 -0800
commitf798bc3c2542b4c3e7b4cb1483d41ce309b4fb51 (patch)
tree5f9ea0d63d0f2861d8950e041e3fc366af579aa1 /player/playloop.c
parent9c22108fec447183a85f8775e92d7c19ea251d75 (diff)
downloadmpv-f798bc3c2542b4c3e7b4cb1483d41ce309b4fb51.tar.bz2
mpv-f798bc3c2542b4c3e7b4cb1483d41ce309b4fb51.tar.xz
player: add --cache-pause-initial option to start in buffering state
Reasons why you'd want this see manpage additions. Disabled by default, because it would increase latency of live streams by default. (Or well, at least it would be another problem when trying getting lower latency.)
Diffstat (limited to 'player/playloop.c')
-rw-r--r--player/playloop.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/player/playloop.c b/player/playloop.c
index 632ccd0999..e9d9112588 100644
--- a/player/playloop.c
+++ b/player/playloop.c
@@ -950,6 +950,17 @@ static void handle_playback_restart(struct MPContext *mpctx)
mpctx->video_status < STATUS_READY)
return;
+ if (opts->cache_pause_initial && (mpctx->video_status == STATUS_READY ||
+ mpctx->audio_status == STATUS_READY))
+ {
+ // Audio or video is restarting, and initial buffering is enabled. Make
+ // sure we actually restart them in paused mode, so no audio gets
+ // dropped and video technically doesn't start yet.
+ mpctx->paused_for_cache = true;
+ mpctx->cache_buffer = 0;
+ update_internal_pause_state(mpctx);
+ }
+
if (mpctx->video_status == STATUS_READY) {
mpctx->video_status = STATUS_PLAYING;
get_relative_time(mpctx);