1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-06-11 09:29:21 +00:00

bugfix: fix update_sync_samples in Mp4TrackWriter where sync is not properly set in stss box #38

This commit is contained in:
Alf 2020-12-24 17:28:43 -08:00
parent b63522186e
commit 2fed4d6486

View file

@ -663,16 +663,19 @@ impl Mp4TrackWriter {
fn update_sync_samples(&mut self, is_sync: bool) {
if let Some(ref mut stss) = self.trak.mdia.minf.stbl.stss {
stss.entries.push(self.sample_id);
} else {
if is_sync {
if !is_sync {
return;
}
let mut stss = StssBox::default();
for i in 1..=self.trak.mdia.minf.stbl.stsz.sample_count {
stss.entries.push(i);
stss.entries.push(self.sample_id);
} else {
if !is_sync {
return;
}
// Create the stts box if not found and push the entry.
let mut stss = StssBox::default();
stss.entries.push(self.sample_id);
self.trak.mdia.minf.stbl.stss = Some(stss);
};
}