ogg: 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:39:13 +00:00
parent 63eda9ddc0
commit d97dd36ae5
3 changed files with 6 additions and 13 deletions

View file

@ -147,7 +147,7 @@ static GstFlowReturn gst_ogg_demux_combine_flows (GstOggDemux * ogg,
GstOggPad * pad, GstFlowReturn ret);
static void gst_ogg_demux_sync_streams (GstOggDemux * ogg);
GstCaps *gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg,
static GstCaps *gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg,
GstCaps * caps, GList * headers);
static gboolean gst_ogg_demux_send_event (GstOggDemux * ogg, GstEvent * event);
static gboolean gst_ogg_demux_perform_seek_push (GstOggDemux * ogg,
@ -2499,7 +2499,7 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg)
return TRUE;
}
GstCaps *
static GstCaps *
gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg, GstCaps * caps,
GList * headers)
{
@ -2534,8 +2534,7 @@ gst_ogg_demux_set_header_on_caps (GstOggDemux * ogg, GstCaps * caps,
headers = headers->next;
}
gst_structure_set_value (structure, "streamheader", &array);
g_value_unset (&array);
gst_structure_take_value (structure, "streamheader", &array);
GST_LOG_OBJECT (ogg, "here are the newly set caps: %" GST_PTR_FORMAT, caps);
return caps;

View file

@ -1117,7 +1117,6 @@ gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
while (walk) {
GstBuffer *buf = GST_BUFFER (walk->data);
GstBuffer *copy;
GValue value = { 0 };
walk = walk->next;
@ -1128,14 +1127,11 @@ gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers)
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
g_value_init (&value, GST_TYPE_BUFFER);
copy = gst_buffer_copy (buf);
gst_value_set_buffer (&value, copy);
gst_buffer_unref (copy);
gst_value_set_buffer (&value, buf);
gst_value_array_append_value (&array, &value);
g_value_unset (&value);
}
gst_structure_set_value (structure, "streamheader", &array);
g_value_unset (&array);
gst_structure_take_value (structure, "streamheader", &array);
return caps;
}

View file

@ -585,12 +585,10 @@ gst_ogg_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_set_value (structure, "streamheader", &array);
gst_structure_take_value (structure, "streamheader", &array);
gst_pad_set_caps (ogg->srcpad, caps);
g_value_unset (&array);
if (ogg->caps)
gst_caps_unref (ogg->caps);
ogg->caps = caps;