mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-03 10:43:55 +00:00
rtpmp4adepay: fix output buffer timestamps in case of multiple frames
This commit is contained in:
parent
581a30d892
commit
3daf1ecc21
1 changed files with 6 additions and 12 deletions
|
@ -315,7 +315,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
guint pos;
|
guint pos;
|
||||||
GstClockTime timestamp;
|
GstClockTime timestamp;
|
||||||
guint offset;
|
|
||||||
|
|
||||||
avail = gst_adapter_available (rtpmp4adepay->adapter);
|
avail = gst_adapter_available (rtpmp4adepay->adapter);
|
||||||
timestamp = gst_adapter_prev_timestamp (rtpmp4adepay->adapter, NULL);
|
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);
|
data = GST_BUFFER_DATA (outbuf);
|
||||||
/* position in data we are at */
|
/* position in data we are at */
|
||||||
pos = 0;
|
pos = 0;
|
||||||
/* timestamp offset */
|
|
||||||
offset = 0;
|
|
||||||
|
|
||||||
/* looping through the number of sub-frames in the audio payload */
|
/* looping through the number of sub-frames in the audio payload */
|
||||||
for (i = 0; i <= rtpmp4adepay->numSubFrames; i++) {
|
for (i = 0; i <= rtpmp4adepay->numSubFrames; i++) {
|
||||||
|
@ -366,18 +363,15 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
data += skip;
|
data += skip;
|
||||||
avail -= 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_BUFFER_TIMESTAMP (tmp) = timestamp;
|
||||||
gst_base_rtp_depayload_push (depayload, tmp);
|
gst_base_rtp_depayload_push (depayload, tmp);
|
||||||
|
|
||||||
/* calculate offsets for next buffers */
|
/* shift ts for next buffers */
|
||||||
if (rtpmp4adepay->frame_len) {
|
if (rtpmp4adepay->frame_len && timestamp != -1
|
||||||
offset += rtpmp4adepay->frame_len;
|
&& depayload->clock_rate != 0) {
|
||||||
|
timestamp +=
|
||||||
|
gst_util_uint64_scale_int (rtpmp4adepay->frame_len, GST_SECOND,
|
||||||
|
depayload->clock_rate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue