summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4gpay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2008-02-12 23:38:19 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2008-02-12 23:38:19 +0000
commit4a7cbe84897d94309c860140d70940a9632d969b (patch)
treefecb57e4a8ab5d48d7a2be27306da169fd9df452 /gst/rtp/gstrtpmp4gpay.c
parent4bb12df00792f09185b7e12704f045ee4ee653f9 (diff)
fixes: #514889
Original commit message from CVS: patch by: Wim Taymans <wim.taymans@collabora.co.uk> 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
Diffstat (limited to 'gst/rtp/gstrtpmp4gpay.c')
-rw-r--r--gst/rtp/gstrtpmp4gpay.c37
1 files changed, 35 insertions, 2 deletions
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)
{