fmp4mux: Only push fragment_offset if write_mfra is true

This is done so that the fragment_offset vector does not infinitely
build up when write_mfra is disabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1023>
This commit is contained in:
Johan Bjäreholt 2022-12-19 11:25:34 +01:00
parent 6607a63159
commit 71c268da14

View file

@ -1505,17 +1505,19 @@ impl FMP4Mux {
.collect::<gst::BufferList>(), .collect::<gst::BufferList>(),
); );
// Write mfra only for the main stream, and if there are no buffers for the main stream if settings.write_mfra {
// in this segment then don't write anything. // Write mfra only for the main stream, and if there are no buffers for the main stream
if let Some(super::FragmentHeaderStream { // in this segment then don't write anything.
start_time: Some(start_time), if let Some(super::FragmentHeaderStream {
.. start_time: Some(start_time),
}) = streams.get(0) ..
{ }) = streams.get(0)
state.fragment_offsets.push(super::FragmentOffset { {
time: *start_time, state.fragment_offsets.push(super::FragmentOffset {
offset: moof_offset, time: *start_time,
}); offset: moof_offset,
});
}
} }
state.end_pts = Some(fragment_end_pts); state.end_pts = Some(fragment_end_pts);