mpeg4videoparse: try harder to make buffer metadata writable before modifying

Also, check buffer for NULL-ness before dereferencing it.

https://bugzilla.gnome.org/show_bug.cgi?id=637824
This commit is contained in:
Tim-Philipp Müller 2010-12-23 22:01:00 +00:00
parent 614c4d8f6e
commit e6d0435a8e

View file

@ -502,10 +502,11 @@ gst_mpeg4vparse_push (GstMpeg4VParse * parse, gsize size)
GstBuffer *out_buf;
out_buf = gst_adapter_take_buffer (parse->adapter, parse->offset);
out_buf = gst_buffer_make_metadata_writable (out_buf);
GST_BUFFER_TIMESTAMP (out_buf) = parse->timestamp;
if (G_LIKELY (out_buf)) {
out_buf = gst_buffer_make_metadata_writable (out_buf);
GST_BUFFER_TIMESTAMP (out_buf) = parse->timestamp;
/* Set GST_BUFFER_FLAG_DELTA_UNIT if it's not an intra frame */
if (!parse->intra_frame) {
GST_BUFFER_FLAG_SET (out_buf, GST_BUFFER_FLAG_DELTA_UNIT);
@ -540,10 +541,10 @@ gst_mpeg4vparse_push (GstMpeg4VParse * parse, gsize size)
/* insert header */
superbuf = gst_buffer_merge (parse->config, out_buf);
GST_BUFFER_TIMESTAMP (superbuf) = timestamp;
gst_buffer_unref (out_buf);
out_buf = superbuf;
out_buf = gst_buffer_make_metadata_writable (superbuf);
GST_BUFFER_TIMESTAMP (out_buf) = timestamp;
if (G_UNLIKELY (timestamp != -1)) {
parse->last_report = timestamp;