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
@ -667,25 +667,13 @@ theora_set_header_on_caps (GstCaps * caps, GList * buffers)
|
|||||||
|
|
||||||
for (walk = buffers; walk; walk = walk->next) {
|
for (walk = buffers; walk; walk = walk->next) {
|
||||||
buffer = walk->data;
|
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);
|
g_value_init (&value, GST_TYPE_BUFFER);
|
||||||
gst_value_set_buffer (&value, buffer);
|
gst_value_set_buffer (&value, buffer);
|
||||||
gst_value_array_append_value (&array, &value);
|
gst_value_array_append_value (&array, &value);
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
|
||||||
/* Unref our copy */
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_structure_set_value (structure, "streamheader", &array);
|
gst_structure_take_value (structure, "streamheader", &array);
|
||||||
g_value_unset (&array);
|
|
||||||
|
|
||||||
return caps;
|
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_OFFSET_END (outbuf) = 0;
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_CLOCK_TIME_NONE;
|
||||||
GST_BUFFER_DURATION (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",
|
GST_DEBUG ("created header packet buffer, %u bytes",
|
||||||
(guint) gst_buffer_get_size (outbuf));
|
(guint) gst_buffer_get_size (outbuf));
|
||||||
|
@ -285,8 +285,7 @@ theora_parse_set_header_on_caps (GstTheoraParse * parse, GstCaps * caps)
|
|||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_structure_set_value (structure, "streamheader", &array);
|
gst_structure_take_value (structure, "streamheader", &array);
|
||||||
g_value_unset (&array);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* two tasks to do here: set the streamheader on the caps, and use libtheora to
|
/* two tasks to do here: set the streamheader on the caps, and use libtheora to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user