qtmux: In prefill mode, only pad buffers with > 0 sized memories as needed

Adding a 0-byte memory has not much effect.

Also add some debug output.
This commit is contained in:
Sebastian Dröge 2017-05-11 19:21:22 +02:00
parent 63492ee141
commit 10f4693163

View file

@ -4096,13 +4096,18 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
goto bail; goto bail;
} }
mem = gst_allocator_alloc (NULL, fill_size, NULL); if (fill_size > 0) {
gst_memory_map (mem, &map, GST_MAP_WRITE); GST_DEBUG_OBJECT (qtmux,
memset (map.data, 0, map.size); "Padding buffer by %u bytes to reach required %u bytes", fill_size,
gst_memory_unmap (mem, &map); required_buffer_size);
last_buf = gst_buffer_make_writable (last_buf); mem = gst_allocator_alloc (NULL, fill_size, NULL);
gst_buffer_append_memory (last_buf, mem); gst_memory_map (mem, &map, GST_MAP_WRITE);
buffer_size = required_buffer_size; memset (map.data, 0, map.size);
gst_memory_unmap (mem, &map);
last_buf = gst_buffer_make_writable (last_buf);
gst_buffer_append_memory (last_buf, mem);
buffer_size = required_buffer_size;
}
} }
/* duration actually means time delta between samples, so we calculate /* duration actually means time delta between samples, so we calculate