From 4a7cbe84897d94309c860140d70940a9632d969b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 12 Feb 2008 23:38:19 +0000 Subject: fixes: #514889 Original commit message from CVS: patch by: Wim Taymans fixes: #514889 * gst/rtp/gstrtph264pay.c: * gst/rtp/gstrtpmp4gdepay.c: * gst/rtp/gstrtpmp4gpay.c: * gst/rtp/gstrtpmp4gpay.h: * gst/rtp/gstrtptheorapay.c: * gst/rtp/gstrtpvorbispay.c: Fix various leaks shown up in valgrind - free sprops and buffer in error cases in H264 payloader - fix leak in mp4g depayloader when construction the caps - don't leak config string in the mp4g payloader - don't leak buffers and headers in theora and vorbis payloaders * tests/check/elements/rtp-payloading.c: Fix the RTP data test - Actually send valid amr data to the payloader instead of 20 zero-bytes - The mp4g payloader expects codec_data on the caps --- gst/rtp/gstrtpmp4gpay.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'gst/rtp/gstrtpmp4gpay.c') diff --git a/gst/rtp/gstrtpmp4gpay.c b/gst/rtp/gstrtpmp4gpay.c index 2b8b8652..92d72240 100644 --- a/gst/rtp/gstrtpmp4gpay.c +++ b/gst/rtp/gstrtpmp4gpay.c @@ -85,6 +85,8 @@ static void gst_rtp_mp4g_pay_finalize (GObject * object); static gboolean gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps); +static GstStateChangeReturn gst_rtp_mp4g_pay_change_state (GstElement * element, + GstStateChange transition); static GstFlowReturn gst_rtp_mp4g_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer); @@ -143,6 +145,8 @@ gst_rtp_mp4g_pay_class_init (GstRtpMP4GPayClass * klass) gobject_class->finalize = gst_rtp_mp4g_pay_finalize; + gstelement_class->change_state = gst_rtp_mp4g_pay_change_state; + gstbasertppayload_class->set_caps = gst_rtp_mp4g_pay_setcaps; gstbasertppayload_class->handle_buffer = gst_rtp_mp4g_pay_handle_buffer; @@ -171,6 +175,10 @@ gst_rtp_mp4g_pay_finalize (GObject * object) g_free (rtpmp4gpay->params); rtpmp4gpay->params = NULL; + if (rtpmp4gpay->config) + gst_buffer_unref (rtpmp4gpay->config); + rtpmp4gpay->config = NULL; + g_free (rtpmp4gpay->profile); rtpmp4gpay->profile = NULL; @@ -504,7 +512,8 @@ gst_rtp_mp4g_pay_flush (GstRtpMP4GPay * rtpmp4gpay) /* marker only if the packet is complete */ gst_rtp_buffer_set_marker (outbuf, avail <= payload_len); - GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4gpay->first_ts; + GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4gpay->first_timestamp; + GST_BUFFER_DURATION (outbuf) = rtpmp4gpay->first_duration; ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpmp4gpay), outbuf); @@ -528,7 +537,8 @@ gst_rtp_mp4g_pay_handle_buffer (GstBaseRTPPayload * basepayload, rtpmp4gpay = GST_RTP_MP4G_PAY (basepayload); - rtpmp4gpay->first_ts = GST_BUFFER_TIMESTAMP (buffer); + rtpmp4gpay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer); + rtpmp4gpay->first_duration = GST_BUFFER_DURATION (buffer); /* we always encode and flush a full AU */ gst_adapter_push (rtpmp4gpay->adapter, buffer); @@ -537,6 +547,29 @@ gst_rtp_mp4g_pay_handle_buffer (GstBaseRTPPayload * basepayload, return ret; } +static GstStateChangeReturn +gst_rtp_mp4g_pay_change_state (GstElement * element, GstStateChange transition) +{ + GstRtpMP4GPay *rtpmp4gpay; + GstStateChangeReturn ret; + + rtpmp4gpay = GST_RTP_MP4G_PAY (element); + + switch (transition) { + default: + break; + } + + ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + default: + break; + } + return ret; +} + + gboolean gst_rtp_mp4g_pay_plugin_init (GstPlugin * plugin) { -- cgit