diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2008-09-26 14:44:49 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2008-09-26 14:44:49 +0000 |
commit | b17599a297fcb5d15a7f871e4ef3230d12b9f024 (patch) | |
tree | 845ca5c65e78f9eb238a5034aeb0ef556e0d4c46 | |
parent | c77bfaacb42b785cd1ac1b5c9e4af8bfb9f1691a (diff) | |
download | gstreamer-plugins-good-b17599a297fcb5d15a7f871e4ef3230d12b9f024.tar.gz |
gst/rtp/gstrtpamrdepay.c: Mark DISCONT on output buffers when the marker bit signals a new talk spurt.
Original commit message from CVS:
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_class_init),
(gst_rtp_amr_depay_process):
Mark DISCONT on output buffers when the marker bit signals a new talk
spurt.
* gst/rtp/gstrtpamrpay.c: (gst_rtp_amr_pay_handle_buffer):
Set the marker bit for buffers with a DISCONT flag to signal a talk
spurt.
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | gst/rtp/gstrtpamrdepay.c | 17 | ||||
-rw-r--r-- | gst/rtp/gstrtpamrpay.c | 22 |
3 files changed, 39 insertions, 11 deletions
@@ -1,5 +1,16 @@ 2008-09-26 Wim Taymans <wim.taymans@collabora.co.uk> + * gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_class_init), + (gst_rtp_amr_depay_process): + Mark DISCONT on output buffers when the marker bit signals a new talk + spurt. + + * gst/rtp/gstrtpamrpay.c: (gst_rtp_amr_pay_handle_buffer): + Set the marker bit for buffers with a DISCONT flag to signal a talk + spurt. + +2008-09-26 Wim Taymans <wim.taymans@collabora.co.uk> + * gst/rtp/Makefile.am: * gst/rtp/gstrtp.c: (plugin_init): * gst/rtp/gstrtpmp4apay.c: (gst_rtp_mp4a_pay_get_type), diff --git a/gst/rtp/gstrtpamrdepay.c b/gst/rtp/gstrtpamrdepay.c index 1694b168c..942911633 100644 --- a/gst/rtp/gstrtpamrdepay.c +++ b/gst/rtp/gstrtpamrdepay.c @@ -27,6 +27,9 @@ #include <string.h> #include "gstrtpamrdepay.h" +GST_DEBUG_CATEGORY_STATIC (rtpamrdepay_debug); +#define GST_CAT_DEFAULT (rtpamrdepay_debug) + /* references: * * RFC 3267 - Real-Time Transport Protocol (RTP) Payload Format and File @@ -146,6 +149,9 @@ gst_rtp_amr_depay_class_init (GstRtpAMRDepayClass * klass) gstbasertpdepayload_class->process = gst_rtp_amr_depay_process; gstbasertpdepayload_class->set_caps = gst_rtp_amr_depay_setcaps; + + GST_DEBUG_CATEGORY_INIT (rtpamrdepay_debug, "rtpamrdepay", 0, + "AMR/AMR-WB RTP Depayloader"); } static void @@ -304,7 +310,9 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) gint i, num_packets, num_nonempty_packets; gint amr_len; gint ILL, ILP; + gboolean marker; + marker = gst_rtp_buffer_get_marker (buf); payload_len = gst_rtp_buffer_get_payload_len (buf); /* need at least 2 bytes for the header */ @@ -412,10 +420,17 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf) /* we can set the duration because each packet is 20 milliseconds */ GST_BUFFER_DURATION (outbuf) = num_packets * 20 * GST_MSECOND; + if (marker) { + /* marker bit marks a discont buffer */ + GST_DEBUG_OBJECT (depayload, "marker bit was set"); + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + marker = FALSE; + } + gst_buffer_set_caps (outbuf, GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload))); - GST_DEBUG ("gst_rtp_amr_depay_chain: pushing buffer of size %d", + GST_DEBUG_OBJECT (depayload, "pushing buffer of size %d", GST_BUFFER_SIZE (outbuf)); } return outbuf; diff --git a/gst/rtp/gstrtpamrpay.c b/gst/rtp/gstrtpamrpay.c index 6365c537b..78a0f1712 100644 --- a/gst/rtp/gstrtpamrpay.c +++ b/gst/rtp/gstrtpamrpay.c @@ -211,6 +211,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, gint i, num_packets, num_nonempty_packets; gint amr_len; gint *frame_size; + gboolean discont; rtpamrpay = GST_RTP_AMR_PAY (basepayload); mtu = GST_BASE_RTP_PAYLOAD_MTU (rtpamrpay); @@ -219,6 +220,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, data = GST_BUFFER_DATA (buffer); timestamp = GST_BUFFER_TIMESTAMP (buffer); duration = GST_BUFFER_DURATION (buffer); + discont = GST_BUFFER_IS_DISCONT (buffer); /* setup frame size pointer */ if (rtpamrpay->mode == GST_RTP_AMR_P_MODE_NB) @@ -267,23 +269,23 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload, /* now alloc output buffer */ outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0); - /* 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; - } + /* copy timestamp */ + GST_BUFFER_TIMESTAMP (outbuf) = timestamp; + /* FIXME: when we do more than one AMR frame per packet, fix this */ if (duration != GST_CLOCK_TIME_NONE) GST_BUFFER_DURATION (outbuf) = duration; else { GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND; } + if (discont) { + GST_DEBUG_OBJECT (basepayload, "discont, setting marker bit"); + GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT); + gst_rtp_buffer_set_marker (outbuf, TRUE); + discont = FALSE; + } + /* get payload, this is now writable */ payload = gst_rtp_buffer_get_payload (outbuf); |