basesrc: Make sure the buffer metadata is writable before changing it

This commit is contained in:
Sebastian Dröge 2010-08-06 18:43:56 +02:00
parent 0cb5660c3e
commit 27bebf7456

View file

@ -2143,12 +2143,16 @@ again:
/* no timestamp set and we are at offset 0, we can timestamp with 0 */ /* no timestamp set and we are at offset 0, we can timestamp with 0 */
if (offset == 0 && src->segment.time == 0 if (offset == 0 && src->segment.time == 0
&& GST_BUFFER_TIMESTAMP (*buf) == -1) && GST_BUFFER_TIMESTAMP (*buf) == -1) {
*buf = gst_buffer_make_metadata_writable (*buf);
GST_BUFFER_TIMESTAMP (*buf) = 0; GST_BUFFER_TIMESTAMP (*buf) = 0;
}
/* set pad caps on the buffer if the buffer had no caps */ /* set pad caps on the buffer if the buffer had no caps */
if (GST_BUFFER_CAPS (*buf) == NULL) if (GST_BUFFER_CAPS (*buf) == NULL) {
*buf = gst_buffer_make_metadata_writable (*buf);
gst_buffer_set_caps (*buf, GST_PAD_CAPS (src->srcpad)); gst_buffer_set_caps (*buf, GST_PAD_CAPS (src->srcpad));
}
/* now sync before pushing the buffer */ /* now sync before pushing the buffer */
status = gst_base_src_do_sync (src, *buf); status = gst_base_src_do_sync (src, *buf);