mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
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.
This commit is contained in:
parent
c77bfaacb4
commit
b17599a297
3 changed files with 39 additions and 11 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
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>
|
2008-09-26 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/rtp/Makefile.am:
|
* gst/rtp/Makefile.am:
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "gstrtpamrdepay.h"
|
#include "gstrtpamrdepay.h"
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (rtpamrdepay_debug);
|
||||||
|
#define GST_CAT_DEFAULT (rtpamrdepay_debug)
|
||||||
|
|
||||||
/* references:
|
/* references:
|
||||||
*
|
*
|
||||||
* RFC 3267 - Real-Time Transport Protocol (RTP) Payload Format and File
|
* 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->process = gst_rtp_amr_depay_process;
|
||||||
gstbasertpdepayload_class->set_caps = gst_rtp_amr_depay_setcaps;
|
gstbasertpdepayload_class->set_caps = gst_rtp_amr_depay_setcaps;
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (rtpamrdepay_debug, "rtpamrdepay", 0,
|
||||||
|
"AMR/AMR-WB RTP Depayloader");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -304,7 +310,9 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
gint i, num_packets, num_nonempty_packets;
|
gint i, num_packets, num_nonempty_packets;
|
||||||
gint amr_len;
|
gint amr_len;
|
||||||
gint ILL, ILP;
|
gint ILL, ILP;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
|
marker = gst_rtp_buffer_get_marker (buf);
|
||||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
|
|
||||||
/* need at least 2 bytes for the header */
|
/* 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 */
|
/* we can set the duration because each packet is 20 milliseconds */
|
||||||
GST_BUFFER_DURATION (outbuf) = num_packets * 20 * GST_MSECOND;
|
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_buffer_set_caps (outbuf,
|
||||||
GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload)));
|
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));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
}
|
}
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
|
@ -211,6 +211,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
||||||
gint i, num_packets, num_nonempty_packets;
|
gint i, num_packets, num_nonempty_packets;
|
||||||
gint amr_len;
|
gint amr_len;
|
||||||
gint *frame_size;
|
gint *frame_size;
|
||||||
|
gboolean discont;
|
||||||
|
|
||||||
rtpamrpay = GST_RTP_AMR_PAY (basepayload);
|
rtpamrpay = GST_RTP_AMR_PAY (basepayload);
|
||||||
mtu = GST_BASE_RTP_PAYLOAD_MTU (rtpamrpay);
|
mtu = GST_BASE_RTP_PAYLOAD_MTU (rtpamrpay);
|
||||||
|
@ -219,6 +220,7 @@ gst_rtp_amr_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
||||||
data = GST_BUFFER_DATA (buffer);
|
data = GST_BUFFER_DATA (buffer);
|
||||||
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
duration = GST_BUFFER_DURATION (buffer);
|
duration = GST_BUFFER_DURATION (buffer);
|
||||||
|
discont = GST_BUFFER_IS_DISCONT (buffer);
|
||||||
|
|
||||||
/* setup frame size pointer */
|
/* setup frame size pointer */
|
||||||
if (rtpamrpay->mode == GST_RTP_AMR_P_MODE_NB)
|
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 */
|
/* now alloc output buffer */
|
||||||
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
||||||
|
|
||||||
/* copy timestamp, or fabricate one */
|
/* copy timestamp */
|
||||||
if (timestamp != GST_CLOCK_TIME_NONE)
|
GST_BUFFER_TIMESTAMP (outbuf) = timestamp;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* FIXME: when we do more than one AMR frame per packet, fix this */
|
||||||
if (duration != GST_CLOCK_TIME_NONE)
|
if (duration != GST_CLOCK_TIME_NONE)
|
||||||
GST_BUFFER_DURATION (outbuf) = duration;
|
GST_BUFFER_DURATION (outbuf) = duration;
|
||||||
else {
|
else {
|
||||||
GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND;
|
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 */
|
/* get payload, this is now writable */
|
||||||
payload = gst_rtp_buffer_get_payload (outbuf);
|
payload = gst_rtp_buffer_get_payload (outbuf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue