summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-10-21 17:26:46 +0600
committerDudemanguy <random342@airmail.cc>2023-10-30 17:16:38 +0000
commit3789f1a3878a46cde7b5ef524f043c24a43b9d41 (patch)
treefd33276cf74d5f1e765eacc0fd8c6f14d6daad5f
parent20fff1e509cb10c60c558be1cc1e243df3edbb32 (diff)
downloadmpv-3789f1a3878a46cde7b5ef524f043c24a43b9d41.tar.bz2
mpv-3789f1a3878a46cde7b5ef524f043c24a43b9d41.tar.xz
demux: make hysteresis-secs respect cache-secs
currently hysteresis-secs only works when the demuxer-max-bytes fills up. but it's possible for the cache-secs/demuxer-readahead-secs to be reached first. in those cases, hysteresis-secs doesn't work and keeps buffering non-stop. but the goal of this option was to save power by avoiding non-stop buffering so go ahead and make it respect cache-secs as well. additionally remove some redundant repetition from the docs.
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--DOCS/man/options.rst10
-rw-r--r--demux/demux.c4
3 files changed, 9 insertions, 7 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 827b960db8..d49e61a340 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -110,6 +110,8 @@ Interface changes
- `--js-memory-report` is now used for enabling memory reporting for javascript
scripts
- drop support for `-del` syntax for list options
+ - `--demuxer-hysteresis-secs` now respects `--cache-secs` and/or
+ `--demuxer-readahead-secs` as well
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 351294b110..a4fb20f8a0 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -3908,18 +3908,16 @@ Demuxer
timestamps.)
``--demuxer-hysteresis-secs=<seconds>``
- Once the ``--demuxer-max-bytes`` limit is reached, this value can be used
+ Once the demuxer limit is reached (``--demuxer-max-bytes``,
+ ``--demuxer-readahead-secs`` or ``--cache-secs``), this value can be used
to specify a hysteresis before the demuxer will buffer ahead again. This
specifies the maximum number of seconds from the current playback position
that needs to be remaining in the cache before the demuxer will continue
buffering ahead.
For example, with a value of 10 seconds specified, the demuxer will buffer
- ahead up to ``--demuxer-max-bytes`` and won't start buffering ahead again
- until there is only 10 seconds of content left in the cache. When the
- demuxer starts buffering ahead again, it will buffer ahead up to
- ``--demuxer-max-bytes`` and stop until there's only 10 seconds of content
- remaining in the cache, and so on.
+ ahead up to the demuxer limit and won't start buffering ahead again until
+ there is only 10 seconds of content left in the cache.
This can provide significant power savings and reduce load by making the
demuxer only buffer ahead in chunks at a time rather than buffering ahead
diff --git a/demux/demux.c b/demux/demux.c
index e44ba75eea..58b6b6ed81 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -2235,8 +2235,10 @@ static bool read_packet(struct demux_internal *in)
return false;
}
- if (!read_more && !prefetch_more && !refresh_more)
+ if (!read_more && !prefetch_more && !refresh_more) {
+ in->hyst_active = !!in->hyst_secs;
return false;
+ }
if (in->after_seek_to_start) {
for (int n = 0; n < in->num_streams; n++) {