diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2014-12-26 11:48:56 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2014-12-26 13:44:35 +0000 |
commit | fd429d3233b47108d877086aa1cfbfef71e13505 (patch) | |
tree | 7e4b02aaa0b5c5b3fb569a5395ac4e00ab65c127 /gst/gdp | |
parent | ad25461dacf9497578aa259b6371b34f4c27070e (diff) | |
download | gstreamer-plugins-bad-fd429d3233b47108d877086aa1cfbfef71e13505.tar.gz |
gdppay: use public API for accessing stream header arrays in caps
Don't rely on core implementation details, which are private and
may change. It's also not needed here, the performance impact is
close to none. Also copy buffer before changing its metadata.
Diffstat (limited to 'gst/gdp')
-rw-r--r-- | gst/gdp/gstgdppay.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c index 751f5f691..33ac591eb 100644 --- a/gst/gdp/gstgdppay.c +++ b/gst/gdp/gstgdppay.c @@ -289,22 +289,24 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this) structure = gst_caps_get_structure (this->caps, 0); if (gst_structure_has_field (structure, "streamheader")) { const GValue *sh; - GArray *buffers; GstBuffer *buffer; - int i; + int i, num; sh = gst_structure_get_value (structure, "streamheader"); - buffers = g_value_peek_pointer (sh); + num = gst_value_array_get_size (sh); GST_DEBUG_OBJECT (this, - "Need to serialize %d incoming streamheader buffers on ours", - buffers->len); - for (i = 0; i < buffers->len; ++i) { - GValue *bufval; + "Need to serialize %d incoming streamheader buffers on ours", num); + for (i = 0; i < num; ++i) { + const GValue *bufval; GstBuffer *outbuffer; - bufval = &g_array_index (buffers, GValue, i); - buffer = g_value_peek_pointer (bufval); + bufval = gst_value_array_get_value (sh, i); + buffer = gst_value_get_buffer (bufval); + + /* Make copy before modifying buffer metadata */ + buffer = gst_buffer_copy (buffer); + /* this buffer is deserialized by gdpdepay as a regular buffer, it needs HEADER, because it's a streamheader - otherwise it is mixed with regular data buffers */ @@ -314,6 +316,9 @@ gst_gdp_pay_reset_streamheader (GstGDPPay * this) GST_BUFFER_TIMESTAMP (buffer) = GST_CLOCK_TIME_NONE; outbuffer = gst_gdp_pay_buffer_from_buffer (this, buffer); + + gst_buffer_unref (buffer); + if (!outbuffer) { g_value_unset (&array); goto no_buffer; |