mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
theora: small GValue optimisations
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:
parent
d97dd36ae5
commit
13b8b35373
2 changed files with 3 additions and 15 deletions
|
@ -667,25 +667,13 @@ theora_set_header_on_caps (GstCaps * caps, GList * buffers)
|
|||
|
||||
for (walk = buffers; walk; walk = walk->next) {
|
||||
buffer = walk->data;
|
||||
|
||||
/* mark buffer */
|
||||
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_HEADER);
|
||||
|
||||
/* Copy buffer, because we can't use the original -
|
||||
* it creates a circular refcount with the caps<->buffers */
|
||||
buffer = gst_buffer_copy (buffer);
|
||||
|
||||
g_value_init (&value, GST_TYPE_BUFFER);
|
||||
gst_value_set_buffer (&value, buffer);
|
||||
gst_value_array_append_value (&array, &value);
|
||||
g_value_unset (&value);
|
||||
|
||||
/* Unref our copy */
|
||||
gst_buffer_unref (buffer);
|
||||
}
|
||||
|
||||
gst_structure_set_value (structure, "streamheader", &array);
|
||||
g_value_unset (&array);
|
||||
gst_structure_take_value (structure, "streamheader", &array);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
@ -844,6 +832,7 @@ theora_enc_buffer_from_header_packet (GstTheoraEnc * enc, ogg_packet * packet)
|
|||
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, %u bytes",
|
||||
(guint) gst_buffer_get_size (outbuf));
|
||||
|
|
|
@ -285,8 +285,7 @@ theora_parse_set_header_on_caps (GstTheoraParse * parse, GstCaps * caps)
|
|||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
gst_structure_set_value (structure, "streamheader", &array);
|
||||
g_value_unset (&array);
|
||||
gst_structure_take_value (structure, "streamheader", &array);
|
||||
}
|
||||
|
||||
/* two tasks to do here: set the streamheader on the caps, and use libtheora to
|
||||
|
|
Loading…
Reference in a new issue