vorbis: small GValue optimisation

No need to copy buffers we put into the streamheader any more
now that we don't put caps on buffers any more, so there's no
danger of a refcount cycle.
This commit is contained in:
Tim-Philipp Müller 2013-03-03 17:42:50 +00:00
parent 13b8b35373
commit 4e1ccb2885
2 changed files with 3 additions and 12 deletions

View file

@ -569,6 +569,7 @@ gst_vorbis_enc_buffer_from_header_packet (GstVorbisEnc * vorbisenc,
GST_BUFFER_OFFSET_END (outbuf) = 0;
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_DURATION (outbuf) = GST_CLOCK_TIME_NONE;
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_HEADER);
GST_DEBUG ("created header packet buffer, %" G_GSIZE_FORMAT " bytes",
gst_buffer_get_size (outbuf));
@ -638,24 +639,15 @@ _gst_caps_set_buffer_array (GstCaps * caps, const gchar * field,
va_start (va, buf);
/* put buffers in a fixed list */
while (buf) {
g_assert (gst_buffer_is_writable (buf));
/* mark buffer */
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
g_value_init (&value, GST_TYPE_BUFFER);
buf = gst_buffer_copy (buf);
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
gst_value_set_buffer (&value, buf);
gst_buffer_unref (buf);
gst_value_array_append_value (&array, &value);
g_value_unset (&value);
buf = va_arg (va, GstBuffer *);
}
gst_structure_set_value (structure, field, &array);
g_value_unset (&array);
gst_structure_take_value (structure, field, &array);
return caps;
}

View file

@ -164,9 +164,8 @@ vorbis_parse_set_header_on_caps (GstVorbisParse * parse, GstCaps * caps)
g_value_init (&value, GST_TYPE_BUFFER);
gst_value_set_buffer (&value, buf3);
gst_value_array_append_value (&array, &value);
gst_structure_set_value (structure, "streamheader", &array);
gst_structure_take_value (structure, "streamheader", &array);
g_value_unset (&value);
g_value_unset (&array);
}
static void