From f5744a39e22adfd749ddd61f1a59d0bb60c87349 Mon Sep 17 00:00:00 2001 From: Andrew Straw Date: Sat, 15 Jun 2024 07:10:38 +0200 Subject: [PATCH] bugfix: sample offset larger than u32 max --- src/track.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/track.rs b/src/track.rs index 7eada83..2c644af 100644 --- a/src/track.rs +++ b/src/track.rs @@ -490,12 +490,12 @@ impl Mp4Track { let first_sample_in_chunk = sample_id - (sample_id - first_sample) % samples_per_chunk; - let mut sample_offset = 0; + let mut sample_offset: u64 = 0; for i in first_sample_in_chunk..sample_id { - sample_offset += self.sample_size(i)?; + sample_offset += self.sample_size(i)? as u64; } - Ok(chunk_offset + sample_offset as u64) + Ok(chunk_offset + sample_offset) } }