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),
#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
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
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 */
/* 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;
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);
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)
/* 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);