1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-12-22 12:06:33 +00:00

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

This commit is contained in:
Alfred Gutierrez 2020-12-24 17:35:13 -08:00 committed by GitHub
parent b63522186e
commit 9c43838793
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -663,16 +663,19 @@ impl Mp4TrackWriter {
fn update_sync_samples(&mut self, is_sync: bool) { fn update_sync_samples(&mut self, is_sync: bool) {
if let Some(ref mut stss) = self.trak.mdia.minf.stbl.stss { if let Some(ref mut stss) = self.trak.mdia.minf.stbl.stss {
stss.entries.push(self.sample_id); if !is_sync {
} else {
if is_sync {
return; return;
} }
let mut stss = StssBox::default(); stss.entries.push(self.sample_id);
for i in 1..=self.trak.mdia.minf.stbl.stsz.sample_count { } else {
stss.entries.push(i); 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); self.trak.mdia.minf.stbl.stss = Some(stss);
}; };
} }