Commit 6717c860 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

rtp: depayloaders: implement process_rtp_packet() vfunc

For more optimised RTP packet handling: means we don't
need to map the input buffer again but can just re-use
the mapping the base class has already done.

https://bugzilla.gnome.org/show_bug.cgi?id=750235
parent fe787425
...@@ -84,7 +84,7 @@ G_DEFINE_TYPE (GstRtpL16Depay, gst_rtp_L16_depay, GST_TYPE_RTP_BASE_DEPAYLOAD); ...@@ -84,7 +84,7 @@ G_DEFINE_TYPE (GstRtpL16Depay, gst_rtp_L16_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
static gboolean gst_rtp_L16_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_L16_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
static void static void
gst_rtp_L16_depay_class_init (GstRtpL16DepayClass * klass) gst_rtp_L16_depay_class_init (GstRtpL16DepayClass * klass)
...@@ -96,7 +96,7 @@ gst_rtp_L16_depay_class_init (GstRtpL16DepayClass * klass) ...@@ -96,7 +96,7 @@ gst_rtp_L16_depay_class_init (GstRtpL16DepayClass * klass)
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass; gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->set_caps = gst_rtp_L16_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_L16_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_L16_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_L16_depay_process;
gst_element_class_add_pad_template (gstelement_class, gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_L16_depay_src_template)); gst_static_pad_template_get (&gst_rtp_L16_depay_src_template));
...@@ -225,26 +225,24 @@ no_clockrate: ...@@ -225,26 +225,24 @@ no_clockrate:
} }
static GstBuffer * static GstBuffer *
gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstRtpL16Depay *rtpL16depay; GstRtpL16Depay *rtpL16depay;
GstBuffer *outbuf; GstBuffer *outbuf;
gint payload_len; gint payload_len;
gboolean marker; gboolean marker;
GstRTPBuffer rtp = { NULL };
rtpL16depay = GST_RTP_L16_DEPAY (depayload); rtpL16depay = GST_RTP_L16_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
if (payload_len <= 0) if (payload_len <= 0)
goto empty_packet; goto empty_packet;
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len); GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (&rtp); marker = gst_rtp_buffer_get_marker (rtp);
if (marker) { if (marker) {
/* mark talk spurt with RESYNC */ /* mark talk spurt with RESYNC */
...@@ -259,8 +257,6 @@ gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -259,8 +257,6 @@ gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
goto reorder_failed; goto reorder_failed;
} }
gst_rtp_buffer_unmap (&rtp);
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */
...@@ -268,14 +264,12 @@ empty_packet: ...@@ -268,14 +264,12 @@ empty_packet:
{ {
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
("Empty Payload."), (NULL)); ("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
reorder_failed: reorder_failed:
{ {
GST_ELEMENT_ERROR (rtpL16depay, STREAM, DECODE, GST_ELEMENT_ERROR (rtpL16depay, STREAM, DECODE,
("Channel reordering failed."), (NULL)); ("Channel reordering failed."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }
......
...@@ -73,7 +73,7 @@ G_DEFINE_TYPE (GstRtpL24Depay, gst_rtp_L24_depay, GST_TYPE_RTP_BASE_DEPAYLOAD); ...@@ -73,7 +73,7 @@ G_DEFINE_TYPE (GstRtpL24Depay, gst_rtp_L24_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
static gboolean gst_rtp_L24_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_L24_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
static void static void
gst_rtp_L24_depay_class_init (GstRtpL24DepayClass * klass) gst_rtp_L24_depay_class_init (GstRtpL24DepayClass * klass)
...@@ -85,7 +85,7 @@ gst_rtp_L24_depay_class_init (GstRtpL24DepayClass * klass) ...@@ -85,7 +85,7 @@ gst_rtp_L24_depay_class_init (GstRtpL24DepayClass * klass)
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass; gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->set_caps = gst_rtp_L24_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_L24_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_L24_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_L24_depay_process;
gst_element_class_add_pad_template (gstelement_class, gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_rtp_L24_depay_src_template)); gst_static_pad_template_get (&gst_rtp_L24_depay_src_template));
...@@ -203,26 +203,24 @@ no_clockrate: ...@@ -203,26 +203,24 @@ no_clockrate:
} }
static GstBuffer * static GstBuffer *
gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstRtpL24Depay *rtpL24depay; GstRtpL24Depay *rtpL24depay;
GstBuffer *outbuf; GstBuffer *outbuf;
gint payload_len; gint payload_len;
gboolean marker; gboolean marker;
GstRTPBuffer rtp = { NULL };
rtpL24depay = GST_RTP_L24_DEPAY (depayload); rtpL24depay = GST_RTP_L24_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
if (payload_len <= 0) if (payload_len <= 0)
goto empty_packet; goto empty_packet;
GST_DEBUG_OBJECT (rtpL24depay, "got payload of %d bytes", payload_len); GST_DEBUG_OBJECT (rtpL24depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (&rtp); marker = gst_rtp_buffer_get_marker (rtp);
if (marker) { if (marker) {
/* mark talk spurt with RESYNC */ /* mark talk spurt with RESYNC */
...@@ -237,8 +235,6 @@ gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -237,8 +235,6 @@ gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
goto reorder_failed; goto reorder_failed;
} }
gst_rtp_buffer_unmap (&rtp);
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */
...@@ -246,14 +242,12 @@ empty_packet: ...@@ -246,14 +242,12 @@ empty_packet:
{ {
GST_ELEMENT_WARNING (rtpL24depay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpL24depay, STREAM, DECODE,
("Empty Payload."), (NULL)); ("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
reorder_failed: reorder_failed:
{ {
GST_ELEMENT_ERROR (rtpL24depay, STREAM, DECODE, GST_ELEMENT_ERROR (rtpL24depay, STREAM, DECODE,
("Channel reordering failed."), (NULL)); ("Channel reordering failed."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }
......
...@@ -67,7 +67,7 @@ G_DEFINE_TYPE (GstRtpAC3Depay, gst_rtp_ac3_depay, GST_TYPE_RTP_BASE_DEPAYLOAD); ...@@ -67,7 +67,7 @@ G_DEFINE_TYPE (GstRtpAC3Depay, gst_rtp_ac3_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
static gboolean gst_rtp_ac3_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_ac3_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
static void static void
gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass) gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass)
...@@ -89,7 +89,7 @@ gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass) ...@@ -89,7 +89,7 @@ gst_rtp_ac3_depay_class_init (GstRtpAC3DepayClass * klass)
"Wim Taymans <wim.taymans@gmail.com>"); "Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->set_caps = gst_rtp_ac3_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_ac3_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_ac3_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_ac3_depay_process;
GST_DEBUG_CATEGORY_INIT (rtpac3depay_debug, "rtpac3depay", 0, GST_DEBUG_CATEGORY_INIT (rtpac3depay_debug, "rtpac3depay", 0,
"AC3 Audio RTP Depayloader"); "AC3 Audio RTP Depayloader");
...@@ -123,22 +123,19 @@ gst_rtp_ac3_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps) ...@@ -123,22 +123,19 @@ gst_rtp_ac3_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
} }
static GstBuffer * static GstBuffer *
gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstRtpAC3Depay *rtpac3depay; GstRtpAC3Depay *rtpac3depay;
GstBuffer *outbuf; GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL, };
guint8 *payload; guint8 *payload;
guint16 FT, NF; guint16 FT, NF;
rtpac3depay = GST_RTP_AC3_DEPAY (depayload); rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); if (gst_rtp_buffer_get_payload_len (rtp) < 2)
if (gst_rtp_buffer_get_payload_len (&rtp) < 2)
goto empty_packet; goto empty_packet;
payload = gst_rtp_buffer_get_payload (&rtp); payload = gst_rtp_buffer_get_payload (rtp);
/* strip off header /* strip off header
* *
...@@ -154,9 +151,7 @@ gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -154,9 +151,7 @@ gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG_OBJECT (rtpac3depay, "FT: %d, NF: %d", FT, NF); GST_DEBUG_OBJECT (rtpac3depay, "FT: %d, NF: %d", FT, NF);
/* We don't bother with fragmented packets yet */ /* We don't bother with fragmented packets yet */
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 2, -1); outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 2, -1);
gst_rtp_buffer_unmap (&rtp);
if (outbuf) if (outbuf)
GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %" G_GSIZE_FORMAT, GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %" G_GSIZE_FORMAT,
...@@ -169,7 +164,6 @@ empty_packet: ...@@ -169,7 +164,6 @@ empty_packet:
{ {
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE, GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
("Empty Payload."), (NULL)); ("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }
......
...@@ -124,7 +124,7 @@ static GstStaticPadTemplate gst_rtp_amr_depay_src_template = ...@@ -124,7 +124,7 @@ static GstStaticPadTemplate gst_rtp_amr_depay_src_template =
static gboolean gst_rtp_amr_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_amr_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
static GstBuffer *gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
#define gst_rtp_amr_depay_parent_class parent_class #define gst_rtp_amr_depay_parent_class parent_class
G_DEFINE_TYPE (GstRtpAMRDepay, gst_rtp_amr_depay, GST_TYPE_RTP_BASE_DEPAYLOAD); G_DEFINE_TYPE (GstRtpAMRDepay, gst_rtp_amr_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
...@@ -148,7 +148,7 @@ gst_rtp_amr_depay_class_init (GstRtpAMRDepayClass * klass) ...@@ -148,7 +148,7 @@ gst_rtp_amr_depay_class_init (GstRtpAMRDepayClass * klass)
"Extracts AMR or AMR-WB audio from RTP packets (RFC 3267)", "Extracts AMR or AMR-WB audio from RTP packets (RFC 3267)",
"Wim Taymans <wim.taymans@gmail.com>"); "Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_amr_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_amr_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_amr_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_amr_depay_setcaps;
GST_DEBUG_CATEGORY_INIT (rtpamrdepay_debug, "rtpamrdepay", 0, GST_DEBUG_CATEGORY_INIT (rtpamrdepay_debug, "rtpamrdepay", 0,
...@@ -281,13 +281,12 @@ static const gint wb_frame_size[16] = { ...@@ -281,13 +281,12 @@ static const gint wb_frame_size[16] = {
}; };
static GstBuffer * static GstBuffer *
gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstRtpAMRDepay *rtpamrdepay; GstRtpAMRDepay *rtpamrdepay;
const gint *frame_size; const gint *frame_size;
GstBuffer *outbuf = NULL; GstBuffer *outbuf = NULL;
gint payload_len; gint payload_len;
GstRTPBuffer rtp = { NULL };
GstMapInfo map; GstMapInfo map;
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload); rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
...@@ -298,8 +297,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -298,8 +297,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
else else
frame_size = wb_frame_size; frame_size = wb_frame_size;
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
/* when we get here, 1 channel, 8000/16000 Hz, octet aligned, no CRC, /* when we get here, 1 channel, 8000/16000 Hz, octet aligned, no CRC,
* no robust sorting, no interleaving data is to be depayloaded */ * no robust sorting, no interleaving data is to be depayloaded */
{ {
...@@ -308,13 +305,13 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -308,13 +305,13 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gint amr_len; gint amr_len;
gint ILL, ILP; gint ILL, ILP;
payload_len = gst_rtp_buffer_get_payload_len (&rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
/* need at least 2 bytes for the header */ /* need at least 2 bytes for the header */
if (payload_len < 2) if (payload_len < 2)
goto too_small; goto too_small;
payload = gst_rtp_buffer_get_payload (&rtp); payload = gst_rtp_buffer_get_payload (rtp);
/* depay CMR. The CMR is used by the sender to request /* depay CMR. The CMR is used by the sender to request
* a new encoding mode. * a new encoding mode.
...@@ -419,7 +416,7 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -419,7 +416,7 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * 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 (gst_rtp_buffer_get_marker (&rtp)) { if (gst_rtp_buffer_get_marker (rtp)) {
/* marker bit marks a buffer after a talkspurt. */ /* marker bit marks a buffer after a talkspurt. */
GST_DEBUG_OBJECT (depayload, "marker bit was set"); GST_DEBUG_OBJECT (depayload, "marker bit was set");
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC); GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
...@@ -429,7 +426,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -429,7 +426,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_buffer_get_size (outbuf)); gst_buffer_get_size (outbuf));
} }
gst_rtp_buffer_unmap (&rtp);
return outbuf; return outbuf;
/* ERRORS */ /* ERRORS */
...@@ -466,7 +462,6 @@ wrong_length_2: ...@@ -466,7 +462,6 @@ wrong_length_2:
bad_packet: bad_packet:
{ {
/* no fatal error */ /* no fatal error */
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
} }
......
...@@ -56,7 +56,7 @@ GST_STATIC_PAD_TEMPLATE ("src", ...@@ -56,7 +56,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
); );
static GstBuffer *gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
static gboolean gst_rtp_bv_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_bv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
...@@ -82,7 +82,7 @@ gst_rtp_bv_depay_class_init (GstRTPBVDepayClass * klass) ...@@ -82,7 +82,7 @@ gst_rtp_bv_depay_class_init (GstRTPBVDepayClass * klass)
"Extracts BroadcomVoice audio from RTP packets (RFC 4298)", "Extracts BroadcomVoice audio from RTP packets (RFC 4298)",
"Wim Taymans <wim.taymans@collabora.co.uk>"); "Wim Taymans <wim.taymans@collabora.co.uk>");
gstrtpbasedepayload_class->process = gst_rtp_bv_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_bv_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_bv_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_bv_depay_setcaps;
} }
...@@ -155,22 +155,18 @@ wrong_rate: ...@@ -155,22 +155,18 @@ wrong_rate:
} }
static GstBuffer * static GstBuffer *
gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstBuffer *outbuf; GstBuffer *outbuf;
gboolean marker; gboolean marker;
GstRTPBuffer rtp = { NULL, };
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); marker = gst_rtp_buffer_get_marker (rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
GST_DEBUG ("process : got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d", GST_DEBUG ("process : got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d",
gst_buffer_get_size (buf), marker, gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp)); gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp); outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
gst_rtp_buffer_unmap (&rtp);
if (marker && outbuf) { if (marker && outbuf) {
/* mark start of talkspurt with RESYNC */ /* mark start of talkspurt with RESYNC */
......
...@@ -65,7 +65,7 @@ GST_STATIC_PAD_TEMPLATE ("src", ...@@ -65,7 +65,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
); );
static GstBuffer *gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, static GstBuffer *gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf); GstRTPBuffer * rtp);
static gboolean gst_rtp_celt_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_celt_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
...@@ -95,7 +95,7 @@ gst_rtp_celt_depay_class_init (GstRtpCELTDepayClass * klass) ...@@ -95,7 +95,7 @@ gst_rtp_celt_depay_class_init (GstRtpCELTDepayClass * klass)
"Extracts CELT audio from RTP packets", "Extracts CELT audio from RTP packets",
"Wim Taymans <wim.taymans@gmail.com>"); "Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_celt_depay_process; gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_celt_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_celt_depay_setcaps; gstrtpbasedepayload_class->set_caps = gst_rtp_celt_depay_setcaps;
} }
...@@ -193,7 +193,7 @@ no_clockrate: ...@@ -193,7 +193,7 @@ no_clockrate:
} }
static GstBuffer * static GstBuffer *
gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{ {
GstBuffer *outbuf = NULL; GstBuffer *outbuf = NULL;
guint8 *payload; guint8 *payload;
...@@ -203,28 +203,25 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -203,28 +203,25 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GstClockTime framesize_ns = 0, timestamp; GstClockTime framesize_ns = 0, timestamp;
guint n = 0; guint n = 0;
GstRtpCELTDepay *rtpceltdepay; GstRtpCELTDepay *rtpceltdepay;
GstRTPBuffer rtp = { NULL, };
rtpceltdepay = GST_RTP_CELT_DEPAY (depayload); rtpceltdepay = GST_RTP_CELT_DEPAY (depayload);
clock_rate = depayload->clock_rate; clock_rate = depayload->clock_rate;
frame_size = rtpceltdepay->frame_size; frame_size = rtpceltdepay->frame_size;
framesize_ns = gst_util_uint64_scale_int (frame_size, GST_SECOND, clock_rate); framesize_ns = gst_util_uint64_scale_int (frame_size, GST_SECOND, clock_rate);
timestamp = GST_BUFFER_PTS (buf); timestamp = GST_BUFFER_PTS (rtp->buffer);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
GST_LOG_OBJECT (depayload, GST_LOG_OBJECT (depayload,
"got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d", "got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d",
gst_buffer_get_size (buf), gst_rtp_buffer_get_marker (&rtp), gst_buffer_get_size (rtp->buffer), gst_rtp_buffer_get_marker (rtp),
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp)); gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
GST_LOG_OBJECT (depayload, "got clock-rate=%d, frame_size=%d, " GST_LOG_OBJECT (depayload, "got clock-rate=%d, frame_size=%d, "
"_ns=%" GST_TIME_FORMAT ", timestamp=%" GST_TIME_FORMAT, clock_rate, "_ns=%" GST_TIME_FORMAT ", timestamp=%" GST_TIME_FORMAT, clock_rate,
frame_size, GST_TIME_ARGS (framesize_ns), GST_TIME_ARGS (timestamp)); frame_size, GST_TIME_ARGS (framesize_ns), GST_TIME_ARGS (timestamp));
payload = gst_rtp_buffer_get_payload (&rtp); payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp); payload_len = gst_rtp_buffer_get_payload_len (rtp);
/* first count how many bytes are consumed by the size headers and make offset /* first count how many bytes are consumed by the size headers and make offset
* point to the first data byte */ * point to the first data byte */
...@@ -249,7 +246,7 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -249,7 +246,7 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
total_size += s + 1; total_size += s + 1;
} while (s == 0xff); } while (s == 0xff);
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, offset, size); outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, offset, size);
offset += size; offset += size;
if (frame_size != -1 && clock_rate != -1) { if (frame_size != -1 && clock_rate != -1) {
...@@ -263,7 +260,6 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -263,7 +260,6 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_base_depayload_push (depayload, outbuf); gst_rtp_base_depayload_push (depayload, outbuf);
} }
gst_rtp_buffer_unmap (&rtp);
return NULL; return NULL;
} }
......
...@@ -75,7 +75,7 @@ static GstStateChangeReturn ...@@ -75,7 +75,7 @@ static GstStateChangeReturn
gst_rtp_dv_depay_change_state (GstElement * element, GstStateChange transition); gst_rtp_dv_depay_change_state (GstElement * element, GstStateChange transition);
static GstBuffer *gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, static GstBuffer *gst_rtp_dv_depay_process (GstRTPBaseDepayload * base,
GstBuffer * in); GstRTPBuffer * rtp);
static gboolean gst_rtp_dv_depay_setcaps (GstRTPBaseDepayload * depayload, static gboolean gst_rtp_dv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps); GstCaps * caps);
...@@ -106,7 +106,7 @@ gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass) ...@@ -106,7 +106,7 @@ gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass)
"Depayloads DV from RTP packets (RFC 3189)", "Depayloads DV from RTP packets (RFC 3189)",
"Marcel Moreaux <marcelm@spacelabs.nl>, Wim Taymans <wim.taymans@gmail.com>"); "Marcel Moreaux <marcelm@spacelabs.nl>, Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process = gstrtpbasedepayload_class->process_rtp_packet =