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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1265>
This commit is contained in:
Tim-Philipp Müller 2021-10-28 17:41:54 +01:00
parent f6ed40c93a
commit 9d5b23ff58

View file

@ -797,7 +797,8 @@ 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
&& gst_buffer_map (mp4vparse->config, &cmap, GST_MAP_READ)) {
diffconf = (gst_buffer_get_size (buffer) < cmap.size) diffconf = (gst_buffer_get_size (buffer) < cmap.size)
|| gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size); || gst_buffer_memcmp (buffer, 0, cmap.data, cmap.size);
csize = cmap.size; csize = cmap.size;
@ -818,6 +819,9 @@ gst_mpeg4vparse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
} else { } else {
GST_INFO_OBJECT (parse, "... but avoiding duplication"); GST_INFO_OBJECT (parse, "... but avoiding duplication");
} }
} else {
GST_WARNING_OBJECT (parse, "No config received yet");
}
if (G_UNLIKELY (timestamp != -1)) { if (G_UNLIKELY (timestamp != -1)) {
mp4vparse->last_report = timestamp; mp4vparse->last_report = timestamp;