]> git.nihav.org Git - nihav.git/commitdiff
mov: fix seeking in audio track with unreported sample size
authorKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 5 Feb 2024 17:52:05 +0000 (18:52 +0100)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Mon, 5 Feb 2024 17:52:05 +0000 (18:52 +0100)
nihav-commonfmt/src/demuxers/mov.rs

index 87eb2f17a9ff366b9082a683480f08aecf8c3bcf..a8d0dfd91787e098eba2402814c2ce056434ae85 100644 (file)
@@ -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() {