From d6a06a2ea631c1acec93b1ffa2f0c895db27e050 Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Sat, 28 Feb 2026 16:50:14 +0900 Subject: [PATCH 1/2] [update] update remaining_duration after success try_seek --- src/source/take.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/source/take.rs b/src/source/take.rs index d9957e6f..84d44208 100644 --- a/src/source/take.rs +++ b/src/source/take.rs @@ -171,6 +171,14 @@ where #[inline] fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> { - self.input.try_seek(pos) + let result = self.input.try_seek(pos); + if result.is_ok() { + // This assumes that the seek implementation of the codec always + // starts again at the beginning of a span. Which is the case with + // symphonia. + self.remaining_duration = self.total_duration().unwrap_or(self.requested_duration).checked_sub(pos).unwrap_or(Duration::ZERO); + self.current_span_len = self.current_span_len(); + } + result } } From 32dbda808d376e9a3ac677439ce07ad85e57ce7c Mon Sep 17 00:00:00 2001 From: Keinsleif Date: Sat, 28 Feb 2026 17:20:26 +0900 Subject: [PATCH 2/2] [fmt] cargo fmt --- src/source/take.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/source/take.rs b/src/source/take.rs index 84d44208..9ec2f247 100644 --- a/src/source/take.rs +++ b/src/source/take.rs @@ -176,7 +176,11 @@ where // This assumes that the seek implementation of the codec always // starts again at the beginning of a span. Which is the case with // symphonia. - self.remaining_duration = self.total_duration().unwrap_or(self.requested_duration).checked_sub(pos).unwrap_or(Duration::ZERO); + self.remaining_duration = self + .total_duration() + .unwrap_or(self.requested_duration) + .checked_sub(pos) + .unwrap_or(Duration::ZERO); self.current_span_len = self.current_span_len(); } result