summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtpamrpay.c
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2006-02-12 13:10:20 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2006-02-12 13:10:20 +0000
commite2a22e497c78b6d196e91a429d2a10fb005daea5 (patch)
tree24d350af29de717f83bbec674979590075068980 /gst/rtp/gstrtpamrpay.c
parenta28e6777bd4a856f8b197a99bf990e4e9ec5a924 (diff)
gst/rtp/gstrtpamrpay.c: set timestamps if no incoming timestamps set
Original commit message from CVS: * gst/rtp/gstrtpamrpay.c: (gst_rtp_amr_pay_handle_buffer): set timestamps if no incoming timestamps set
Diffstat (limited to 'gst/rtp/gstrtpamrpay.c')
-rw-r--r--gst/rtp/gstrtpamrpay.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gst/rtp/gstrtpamrpay.c b/gst/rtp/gstrtpamrpay.c
index da9944e5..27588d8c 100644
--- a/gst/rtp/gstrtpamrpay.c
+++ b/gst/rtp/gstrtpamrpay.c
@@ -36,7 +36,7 @@ GST_DEBUG_CATEGORY (rtpamrpay_debug);
static GstElementDetails gst_rtp_amrpay_details = {
"RTP packet parser",
"Codec/Payloader/Network",
- "Payode AMR audio into RTP packets (RFC 3267)",
+ "Payload-encode AMR audio into RTP packets (RFC 3267)",
"Wim Taymans <wim@fluendo.com>"
};
@@ -230,8 +230,16 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload,
/* now alloc output buffer */
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
- /* copy timestamp */
- GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
+ /* copy timestamp, or fabricate one */
+ if (timestamp != GST_CLOCK_TIME_NONE)
+ GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
+ else {
+ /* AMR (nb) and AMR-WB both have 20 ms per frame */
+ /* FIXME: when we do more than one AMR frame per packet, fix this */
+ gint count = basepayload->seqnum - basepayload->seqnum_base;
+
+ GST_BUFFER_TIMESTAMP (outbuf) = count * 20 * GST_MSECOND;
+ }
/* get payload, this is now writable */
payload = gst_rtp_buffer_get_payload (outbuf);