summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-04-01 18:11:23 +0200
committerTim-Philipp Müller <tim@centricular.net>2012-09-11 01:54:45 +0100
commit946dbd38d8feab83ebb165ffc33792b54748704b (patch)
tree5b99bd5c05fa68d0b0ea14c8db0747710933e0d5
parentf12af88f4ae8a52b7dfdee507a6e7c300f398f48 (diff)
Improve buffer allocation of wrapped memory
-rw-r--r--gst/gdp/gstgdppay.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/gst/gdp/gstgdppay.c b/gst/gdp/gstgdppay.c
index aab3f85a9..335c984c4 100644
--- a/gst/gdp/gstgdppay.c
+++ b/gst/gdp/gstgdppay.c
@@ -226,14 +226,10 @@ gst_gdp_buffer_from_caps (GstGDPPay * this, GstCaps * caps)
goto packet_failed;
GST_LOG_OBJECT (this, "creating GDP header and payload buffer from caps");
- headerbuf = gst_buffer_new ();
- gst_buffer_append_memory (headerbuf,
- gst_memory_new_wrapped (0, header, len, 0, len, header, g_free));
+ headerbuf = gst_buffer_new_wrapped (header, len);
- payloadbuf = gst_buffer_new ();
plen = gst_dp_header_payload_length (header);
- gst_buffer_append_memory (payloadbuf,
- gst_memory_new_wrapped (0, payload, plen, 0, plen, payload, g_free));
+ payloadbuf = gst_buffer_new_wrapped (payload, plen);
return gst_buffer_append (headerbuf, payloadbuf);
@@ -257,9 +253,7 @@ gst_gdp_pay_buffer_from_buffer (GstGDPPay * this, GstBuffer * buffer)
goto no_buffer;
GST_LOG_OBJECT (this, "creating GDP header and payload buffer from buffer");
- headerbuf = gst_buffer_new ();
- gst_buffer_append_memory (headerbuf,
- gst_memory_new_wrapped (0, header, len, 0, len, header, g_free));
+ headerbuf = gst_buffer_new_wrapped (header, len);
/* we do not want to lose the ref on the incoming buffer */
gst_buffer_ref (buffer);
@@ -290,9 +284,7 @@ gst_gdp_buffer_from_event (GstGDPPay * this, GstEvent * event)
goto no_event;
GST_LOG_OBJECT (this, "creating GDP header and payload buffer from event");
- headerbuf = gst_buffer_new ();
- gst_buffer_append_memory (headerbuf,
- gst_memory_new_wrapped (0, header, len, 0, len, header, g_free));
+ headerbuf = gst_buffer_new_wrapped (header, len);
payloadbuf = gst_buffer_new ();
plen = gst_dp_header_payload_length (header);