From c771c86631b97eb1765b389573cfce8cc584e83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 10 Nov 2022 10:51:10 +0200 Subject: [PATCH] mp4mux: Skip gap buffers instead of writing empty samples Part-of: --- mux/mp4/src/mp4mux/imp.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mux/mp4/src/mp4mux/imp.rs b/mux/mp4/src/mp4mux/imp.rs index a57de86c..1fc1a682 100644 --- a/mux/mp4/src/mp4mux/imp.rs +++ b/mux/mp4/src/mp4mux/imp.rs @@ -783,6 +783,14 @@ impl MP4Mux { let stream = &mut state.streams[idx]; let buffer = stream.pending_buffer.take().unwrap(); + if buffer.buffer.flags().contains(gst::BufferFlags::GAP) + && buffer.buffer.flags().contains(gst::BufferFlags::DROPPABLE) + && buffer.buffer.size() == 0 + { + gst::trace!(CAT, obj: stream.sinkpad, "Skipping gap buffer {buffer:?}"); + continue; + } + gst::trace!(CAT, obj: stream.sinkpad, "Handling buffer {buffer:?} at offset {}", state.current_offset); let duration = buffer.duration.unwrap();