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) ...@@ -793,26 +793,30 @@ gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
/* we need to send config now first */ /* we need to send config now first */
GST_INFO_OBJECT (parse, "inserting config in stream"); GST_INFO_OBJECT (parse, "inserting config in stream");
gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ); if (mp4vparse->config != NULL
diffconf = (gst_buffer_get_size (buffer) < cmap.size) && gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ)) {
|| gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size); diffconf = (gst_buffer_get_size (buffer) < cmap.size)
csize = cmap.size; || gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size);
gst_buffer_unmap (mp4vparse->config, &cmap); csize = cmap.size;
gst_buffer_unmap (mp4vparse->config, &cmap);
/* avoid inserting duplicate config */
if (diffconf) { /* avoid inserting duplicate config */
GstBuffer *superbuf; if (diffconf) {
GstBuffer *superbuf;
/* insert header */
superbuf = /* insert header */
gst_buffer_append (gst_buffer_ref (mp4vparse->config), superbuf =
gst_buffer_ref (buffer)); gst_buffer_append (gst_buffer_ref (mp4vparse->config),
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0, gst_buffer_ref (buffer));
csize); gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
gst_buffer_replace (&frame->out_buffer, superbuf); csize);
gst_buffer_unref (superbuf); gst_buffer_replace (&frame->out_buffer, superbuf);
gst_buffer_unref (superbuf);
} else {
GST_INFO_OBJECT (parse, "... but avoiding duplication");
}
} else { } else {
GST_INFO_OBJECT (parse, "... but avoiding duplication"); GST_WARNING_OBJECT (parse, "No config received yet");
} }
if (G_UNLIKELY (timestamp != -1)) { 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