From 135700ce02431a10bdf30f3de2e60c88b6293a3a Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Tue, 9 Dec 2025 12:06:59 +0100 Subject: [PATCH] Update cache metric refresh rate to match other metadata Move cache duration update from update_properties (~10Hz) to update_metadata (~0.5Hz) to match the refresh rate of codec, bitrate, and sample rate. All bottom status bar metrics now update at the same frequency. --- Cargo.toml | 2 +- src/player/mod.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1fa171b..ced0433 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-player" -version = "0.1.15" +version = "0.1.16" edition = "2021" [dependencies] diff --git a/src/player/mod.rs b/src/player/mod.rs index 0950aa3..c4ea300 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -249,13 +249,6 @@ impl Player { self.is_idle = idle; } } - - // Update cache duration (how many seconds are buffered ahead) - if let Some(val) = self.get_property("demuxer-cache-duration") { - self.cache_duration = val.as_f64(); - } else { - self.cache_duration = None; - } } pub fn update_metadata(&mut self) { @@ -313,6 +306,13 @@ impl Player { if let Some(val) = self.get_property("audio-params/samplerate") { self.sample_rate = val.as_i64(); } + + // Update cache duration (how many seconds are buffered ahead) + if let Some(val) = self.get_property("demuxer-cache-duration") { + self.cache_duration = val.as_f64(); + } else { + self.cache_duration = None; + } } pub fn get_position(&self) -> Option {