summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpmp4vpay.c
diff options
context:
space:
mode:
authorAntoine Tremblay <hexa00@gmail.com>2007-09-27 11:10:12 +0000
committerWim Taymans <wim.taymans@gmail.com>2007-09-27 11:10:12 +0000
commit74975e7e64a49331560cccf2ebfc57fe3df26b35 (patch)
tree58fc5f1154691c4c4f2d0cea55575f1c1ec32588 /gst/rtp/gstrtpmp4vpay.c
parent4683ff80d3a9535f92708a8966c3d2793294ee48 (diff)
gst/rtp/gstrtpmp4vpay.*: Free the config string. Fixes #480707.
Original commit message from CVS: Patch by: Antoine Tremblay <hexa00 at gmail dot com> * gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_init), (gst_rtp_mp4v_pay_finalize), (gst_rtp_mp4v_pay_flush), (gst_rtp_mp4v_pay_handle_buffer): * gst/rtp/gstrtpmp4vpay.h: Free the config string. Fixes #480707. Clean up the timestamp code a little.
Diffstat (limited to 'gst/rtp/gstrtpmp4vpay.c')
-rw-r--r--gst/rtp/gstrtpmp4vpay.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/gst/rtp/gstrtpmp4vpay.c b/gst/rtp/gstrtpmp4vpay.c
index 816bf97c..819f4097 100644
--- a/gst/rtp/gstrtpmp4vpay.c
+++ b/gst/rtp/gstrtpmp4vpay.c
@@ -167,6 +167,8 @@ gst_rtp_mp4v_pay_init (GstRtpMP4VPay * rtpmp4vpay)
rtpmp4vpay->profile = 1;
rtpmp4vpay->send_config = DEFAULT_SEND_CONFIG;
+ rtpmp4vpay->config = NULL;
+
sinkpad = GST_BASE_RTP_PAYLOAD_SINKPAD (rtpmp4vpay);
rtpmp4vpay->old_event_func = sinkpad->eventfunc;
@@ -180,6 +182,10 @@ gst_rtp_mp4v_pay_finalize (GObject * object)
rtpmp4vpay = GST_RTP_MP4V_PAY (object);
+ if (rtpmp4vpay->config) {
+ g_object_unref (rtpmp4vpay->config);
+ rtpmp4vpay->config = NULL;
+ }
g_object_unref (rtpmp4vpay->adapter);
rtpmp4vpay->adapter = NULL;
@@ -301,7 +307,7 @@ gst_rtp_mp4v_pay_flush (GstRtpMP4VPay * rtpmp4vpay)
gst_rtp_buffer_set_marker (outbuf, avail == 0);
- GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4vpay->first_ts;
+ GST_BUFFER_TIMESTAMP (outbuf) = rtpmp4vpay->first_timestamp;
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpmp4vpay), outbuf);
}
@@ -405,7 +411,7 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
guint8 *data;
gboolean flush;
gint strip;
- GstClockTime duration;
+ GstClockTime timestamp, duration;
ret = GST_FLOW_OK;
@@ -413,12 +419,16 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
size = GST_BUFFER_SIZE (buffer);
data = GST_BUFFER_DATA (buffer);
+ timestamp = GST_BUFFER_TIMESTAMP (buffer);
duration = GST_BUFFER_DURATION (buffer);
avail = gst_adapter_available (rtpmp4vpay->adapter);
+ if (duration == -1)
+ duration = 0;
+
/* empty buffer, take timestamp */
if (avail == 0) {
- rtpmp4vpay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4vpay->first_timestamp = timestamp;
rtpmp4vpay->duration = 0;
}
@@ -432,7 +442,7 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
/* strip off header */
subbuf = gst_buffer_create_sub (buffer, strip, size - strip);
- GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buffer);
+ GST_BUFFER_TIMESTAMP (subbuf) = timestamp;
gst_buffer_unref (buffer);
buffer = subbuf;
@@ -444,7 +454,7 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
/* if we need to flush, do so now */
if (flush) {
ret = gst_rtp_mp4v_pay_flush (rtpmp4vpay);
- rtpmp4vpay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4vpay->first_timestamp = timestamp;
rtpmp4vpay->duration = 0;
avail = 0;
}
@@ -455,12 +465,13 @@ gst_rtp_mp4v_pay_handle_buffer (GstBaseRTPPayload * basepayload,
if (gst_basertppayload_is_filled (basepayload,
packet_len, rtpmp4vpay->duration + duration)) {
ret = gst_rtp_mp4v_pay_flush (rtpmp4vpay);
- rtpmp4vpay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
+ rtpmp4vpay->first_timestamp = timestamp;
rtpmp4vpay->duration = 0;
}
/* push new data */
gst_adapter_push (rtpmp4vpay->adapter, buffer);
+
rtpmp4vpay->duration += duration;
return ret;