From 9c22108fec447183a85f8775e92d7c19ea251d75 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 3 Jan 2018 21:28:28 +0100 Subject: player: use fixed timeout for cache pausing (buffering) duration This tried to be clever by waiting for a longer time each time the buffer was underrunning, or shorter if it was getting better. I think this was pretty weird behavior and makes no sense. If the user really wants the stream to buffer longer, he/she/it can just pause the player (the network caches will continue to be filled until they're full). Every time I actually noticed this code triggering in my own use, I didn't find it helpful. Apart from that it was pretty hard to test. Some waiting is needed to avoid that the player just plays the available data as fast as possible (to compensate for late frames and underrunning audio). Just use a fixed wait time, which can now be controlled by the new --cache-pause-wait option. --- options/options.c | 2 ++ options/options.h | 1 + 2 files changed, 3 insertions(+) (limited to 'options') diff --git a/options/options.c b/options/options.c index 4e40d77a90..030ba6f9e6 100644 --- a/options/options.c +++ b/options/options.c @@ -451,6 +451,7 @@ const m_option_t mp_opts[] = { OPT_FLAG("demuxer-thread", demuxer_thread, 0), OPT_FLAG("prefetch-playlist", prefetch_open, 0), OPT_FLAG("cache-pause", cache_pausing, 0), + OPT_FLOAT("cache-pause-wait", cache_pause_wait, M_OPT_MIN, .min = 0), OPT_DOUBLE("mf-fps", mf_fps, 0), OPT_STRING("mf-type", mf_type, 0), @@ -894,6 +895,7 @@ const struct MPOpts mp_default_opts = { .demuxer_thread = 1, .hls_bitrate = INT_MAX, .cache_pausing = 1, + .cache_pause_wait = 1.0, .chapterrange = {-1, -1}, .ab_loop = {MP_NOPTS_VALUE, MP_NOPTS_VALUE}, .edition_id = -1, diff --git a/options/options.h b/options/options.h index 3f90a2b78f..3774b7b343 100644 --- a/options/options.h +++ b/options/options.h @@ -263,6 +263,7 @@ typedef struct MPOpts { char *sub_demuxer_name; int cache_pausing; + float cache_pause_wait; struct image_writer_opts *screenshot_image_opts; char *screenshot_template; -- cgit v1.2.3