From 0b428e44829abc4387f051e3c618c1c878b3a838 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 27 Aug 2014 01:13:20 +0200 Subject: player: redo how stream caching and pausing on low cache works Add the --cache-secs option, which literally overrides the value of --demuxer-readahead-secs if the stream cache is active. The default value is very high (10 seconds), which means it can act as network cache. Remove the old behavior of trying to pause once the byte cache runs low. Instead, do something similar wit the demuxer cache. The nice thing is that we can guess how many seconds of video it has cached, and we can make better decisions. But for now, apply a relatively naive heuristic: if the cache is below 0.5 secs, pause, and wait until at least 2 secs are available. Note that due to timestamp reordering, the estimated cached duration of video might be inaccurate, depending on the file format. If the file format has DTS, it's easy, otherwise the duration will seemingly jump back and forth. --- stream/stream.c | 1 + 1 file changed, 1 insertion(+) (limited to 'stream') diff --git a/stream/stream.c b/stream/stream.c index d600088267..7b8050dec0 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -782,6 +782,7 @@ static stream_t *open_cache(stream_t *orig, const char *name) cache->demuxer = talloc_strdup(cache, orig->demuxer); cache->lavf_type = talloc_strdup(cache, orig->lavf_type); cache->safe_origin = orig->safe_origin; + cache->streaming = orig->streaming, cache->opts = orig->opts; cache->global = orig->global; -- cgit v1.2.3