summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-11-11 10:24:07 -0600
committersfan5 <sfan5@live.de>2023-11-12 11:47:16 +0100
commit0286e7f2067d7e7d6b2528a49f9541b3fb852e4d (patch)
treee0007c078e52e78a3fd6f382a9dcbda79ae79860 /demux
parent7cab30cec77b3fe4b8ca85b37664a3dc9b270aee (diff)
downloadmpv-0286e7f2067d7e7d6b2528a49f9541b3fb852e4d.tar.bz2
mpv-0286e7f2067d7e7d6b2528a49f9541b3fb852e4d.tar.xz
demux: always update the cache on init
cd59ea8afab6381951a3ae19a43e422906d02164 removed an arbitrary start offset added to the timer. However, it turns out that demux secretly depends on this. When updating cache to actually read bytes from the stream, there's a diff >= MP_TIME_S_TO_NS(1) check to make it only update once every second. With the old MP_START_TIME macro, the initial time value would always be at least 1e10, so this would also be true. Since we don't have that offset anymore, now the initial time is less than that so it is not updated and properties like file-size are 0. Just be sure to always update if the last_speed_query is 0 (i.e. we just started the player). Fixes #12869.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 905a301bd1..99aae7956c 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -4131,7 +4131,7 @@ static void update_cache(struct demux_internal *in)
int64_t now = mp_time_ns();
int64_t diff = now - in->last_speed_query;
- bool do_update = diff >= MP_TIME_S_TO_NS(1);
+ bool do_update = diff >= MP_TIME_S_TO_NS(1) || !in->last_speed_query;
// Don't lock while querying the stream.
mp_mutex_unlock(&in->lock);