From c6432d30823e5b5372e74290b34bf89af6ece52f Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 5 Feb 2024 18:52:05 +0100 Subject: [PATCH] mov: fix seeking in audio track with unreported sample size --- nihav-commonfmt/src/demuxers/mov.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nihav-commonfmt/src/demuxers/mov.rs b/nihav-commonfmt/src/demuxers/mov.rs index 87eb2f1..a8d0dfd 100644 --- a/nihav-commonfmt/src/demuxers/mov.rs +++ b/nihav-commonfmt/src/demuxers/mov.rs @@ -1481,7 +1481,9 @@ impl Track { self.samples_left = csamp - self.cur_sample; self.cur_chunk += 1; } - } else if self.chunk_offsets.len() == self.chunk_sizes.len() { + } else if self.chunk_offsets.len() == self.chunk_sizes.len() && self.duration != 0 { + let new_sample = (self.chunk_sizes.len() as u64 * exp_pts / u64::from(self.duration)) as usize; + self.cur_sample = new_sample; self.cur_chunk = self.cur_sample; } else { if !self.time_to_sample.is_empty() { -- 2.39.5