diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2022-05-27 11:05:36 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2022-06-30 16:35:56 +0300 |
commit | 6edb188899b0aa2c664cb09ab185678d69d3592a (patch) | |
tree | 5a3b853b138dc2eb11f316aca2a9b58d1a6dd614 /generic | |
parent | 51c7d0652e27d1dd2ae1f88bd5dbba67c2e151ff (diff) |
fmp4mux: Fix usage of first_sample_flags/default_sample_flags
Previously first_sample_flags was never used so if the first sample was
a keyframe and all others not then each sample got its own flags.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/fmp4/src/fmp4mux/boxes.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/fmp4/src/fmp4mux/boxes.rs b/generic/fmp4/src/fmp4mux/boxes.rs index 47612141b..befdf4953 100644 --- a/generic/fmp4/src/fmp4mux/boxes.rs +++ b/generic/fmp4/src/fmp4mux/boxes.rs @@ -1624,12 +1624,11 @@ fn analyze_buffers( let f = sample_flags_from_buffer(buffer, intra_only); if first_buffer_flags.is_none() { first_buffer_flags = Some(f); + } else { flags = Some(f); - } else if flags.is_none() { if Some(f) != first_buffer_flags { tr_flags |= FIRST_SAMPLE_FLAGS_PRESENT; } - flags = Some(f); } if flags.is_some() && Some(f) != flags { @@ -1686,6 +1685,13 @@ fn analyze_buffers( duration = None; } + // If there is only a single buffer use its flags as default sample flags + // instead of first sample flags. + if flags.is_none() && first_buffer_flags.is_some() { + tr_flags &= !FIRST_SAMPLE_FLAGS_PRESENT; + flags = first_buffer_flags.take(); + } + if (tr_flags & SAMPLE_FLAGS_PRESENT) == 0 { tf_flags |= DEFAULT_SAMPLE_FLAGS_PRESENT; } else { |