Commit 14647d63 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

mpeg4videoparse: fix criticals trying to insert configs that don't exist yet

With mpeg4videoparse drop=false config-interval=N|-1 we might be
trying to insert a config before we have actually received one,
in which case we'll try to map a NULL buffer which will generate
lots of criticals.

Fixes #855

Part-of: <!2558>
parent 7391ff71
Pipeline #436404 waiting for manual action with stages
in 1 minute and 26 seconds
......@@ -793,26 +793,30 @@ gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
/* we need to send config now first */
GST_INFO_OBJECT (parse, "inserting config in stream");
gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ);
diffconf = (gst_buffer_get_size (buffer) < cmap.size)
|| gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size);
csize = cmap.size;
gst_buffer_unmap (mp4vparse->config, &cmap);
/* avoid inserting duplicate config */
if (diffconf) {
GstBuffer *superbuf;
/* insert header */
superbuf =
gst_buffer_append (gst_buffer_ref (mp4vparse->config),
gst_buffer_ref (buffer));
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
csize);
gst_buffer_replace (&frame->out_buffer, superbuf);
gst_buffer_unref (superbuf);
if (mp4vparse->config != NULL
&& gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ)) {
diffconf = (gst_buffer_get_size (buffer) < cmap.size)
|| gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size);
csize = cmap.size;
gst_buffer_unmap (mp4vparse->config, &cmap);
/* avoid inserting duplicate config */
if (diffconf) {
GstBuffer *superbuf;
/* insert header */
superbuf =
gst_buffer_append (gst_buffer_ref (mp4vparse->config),
gst_buffer_ref (buffer));
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
csize);
gst_buffer_replace (&frame->out_buffer, superbuf);
gst_buffer_unref (superbuf);
} else {
GST_INFO_OBJECT (parse, "... but avoiding duplication");
}
} else {
GST_INFO_OBJECT (parse, "... but avoiding duplication");
GST_WARNING_OBJECT (parse, "No config received yet");
}
if (G_UNLIKELY (timestamp != -1)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment