mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
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:
parent
f6ed40c93a
commit
9d5b23ff58
1 changed files with 21 additions and 17 deletions
|
@ -797,26 +797,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 */
|
/* avoid inserting duplicate config */
|
||||||
if (diffconf) {
|
if (diffconf) {
|
||||||
GstBuffer *superbuf;
|
GstBuffer *superbuf;
|
||||||
|
|
||||||
/* insert header */
|
/* insert header */
|
||||||
superbuf =
|
superbuf =
|
||||||
gst_buffer_append (gst_buffer_ref (mp4vparse->config),
|
gst_buffer_append (gst_buffer_ref (mp4vparse->config),
|
||||||
gst_buffer_ref (buffer));
|
gst_buffer_ref (buffer));
|
||||||
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
|
gst_buffer_copy_into (superbuf, buffer, GST_BUFFER_COPY_METADATA, 0,
|
||||||
csize);
|
csize);
|
||||||
gst_buffer_replace (&frame->out_buffer, superbuf);
|
gst_buffer_replace (&frame->out_buffer, superbuf);
|
||||||
gst_buffer_unref (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)) {
|
||||||
|
|
Loading…
Reference in a new issue