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.
This commit is contained in:
NRK 2023-10-21 17:26:46 +06:00 committed by Dudemanguy
parent 20fff1e509
commit 3789f1a387
3 changed files with 9 additions and 7 deletions

View File

@ -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.

View File

@ -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

View File

@ -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++) {