From 3daf1ecc212e4bd46f599c07ecfb5356f731986d Mon Sep 17 00:00:00 2001 From: Mark Nauwelaerts Date: Tue, 21 Jun 2011 15:15:06 +0200 Subject: [PATCH] rtpmp4adepay: fix output buffer timestamps in case of multiple frames --- gst/rtp/gstrtpmp4adepay.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/gst/rtp/gstrtpmp4adepay.c b/gst/rtp/gstrtpmp4adepay.c index 664864abe1..00899c46fd 100644 --- a/gst/rtp/gstrtpmp4adepay.c +++ b/gst/rtp/gstrtpmp4adepay.c @@ -315,7 +315,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) guint8 *data; guint pos; GstClockTime timestamp; - guint offset; avail = gst_adapter_available (rtpmp4adepay->adapter); timestamp = gst_adapter_prev_timestamp (rtpmp4adepay->adapter, NULL); @@ -326,8 +325,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) data = GST_BUFFER_DATA (outbuf); /* position in data we are at */ pos = 0; - /* timestamp offset */ - offset = 0; /* looping through the number of sub-frames in the audio payload */ for (i = 0; i <= rtpmp4adepay->numSubFrames; i++) { @@ -366,18 +363,15 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) data += skip; avail -= skip; - if (offset > 0 && timestamp != -1 && depayload->clock_rate != 0) { - timestamp += - gst_util_uint64_scale_int (offset, GST_SECOND, - depayload->clock_rate); - } - GST_BUFFER_TIMESTAMP (tmp) = timestamp; gst_base_rtp_depayload_push (depayload, tmp); - /* calculate offsets for next buffers */ - if (rtpmp4adepay->frame_len) { - offset += rtpmp4adepay->frame_len; + /* shift ts for next buffers */ + if (rtpmp4adepay->frame_len && timestamp != -1 + && depayload->clock_rate != 0) { + timestamp += + gst_util_uint64_scale_int (rtpmp4adepay->frame_len, GST_SECOND, + depayload->clock_rate); } }