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
This commit is contained in:
Tim-Philipp Müller 2015-07-12 14:27:15 +01:00
parent fe787425bc
commit 6717c86061
40 changed files with 297 additions and 502 deletions

View file

@ -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,
GstCaps * caps);
static GstBuffer *gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
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->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_static_pad_template_get (&gst_rtp_L16_depay_src_template));
@ -225,26 +225,24 @@ no_clockrate:
}
static GstBuffer *
gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpL16Depay *rtpL16depay;
GstBuffer *outbuf;
gint payload_len;
gboolean marker;
GstRTPBuffer rtp = { NULL };
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)
goto empty_packet;
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker) {
/* mark talk spurt with RESYNC */
@ -259,8 +257,6 @@ gst_rtp_L16_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
goto reorder_failed;
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -268,14 +264,12 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
reorder_failed:
{
GST_ELEMENT_ERROR (rtpL16depay, STREAM, DECODE,
("Channel reordering failed."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -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,
GstCaps * caps);
static GstBuffer *gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
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->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_static_pad_template_get (&gst_rtp_L24_depay_src_template));
@ -203,26 +203,24 @@ no_clockrate:
}
static GstBuffer *
gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpL24Depay *rtpL24depay;
GstBuffer *outbuf;
gint payload_len;
gboolean marker;
GstRTPBuffer rtp = { NULL };
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)
goto empty_packet;
GST_DEBUG_OBJECT (rtpL24depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker) {
/* mark talk spurt with RESYNC */
@ -237,8 +235,6 @@ gst_rtp_L24_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
goto reorder_failed;
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -246,14 +242,12 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpL24depay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
reorder_failed:
{
GST_ELEMENT_ERROR (rtpL24depay, STREAM, DECODE,
("Channel reordering failed."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -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,
GstCaps * caps);
static GstBuffer *gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
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>");
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,
"AC3 Audio RTP Depayloader");
@ -123,22 +123,19 @@ gst_rtp_ac3_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpAC3Depay *rtpac3depay;
GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL, };
guint8 *payload;
guint16 FT, NF;
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;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
/* strip off header
*
@ -154,9 +151,7 @@ gst_rtp_ac3_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG_OBJECT (rtpac3depay, "FT: %d, NF: %d", FT, NF);
/* We don't bother with fragmented packets yet */
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 2, -1);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 2, -1);
if (outbuf)
GST_DEBUG_OBJECT (rtpac3depay, "pushing buffer of size %" G_GSIZE_FORMAT,
@ -169,7 +164,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -124,7 +124,7 @@ static GstStaticPadTemplate gst_rtp_amr_depay_src_template =
static gboolean gst_rtp_amr_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
#define gst_rtp_amr_depay_parent_class parent_class
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)
"Extracts AMR or AMR-WB audio from RTP packets (RFC 3267)",
"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;
GST_DEBUG_CATEGORY_INIT (rtpamrdepay_debug, "rtpamrdepay", 0,
@ -281,13 +281,12 @@ static const gint wb_frame_size[16] = {
};
static GstBuffer *
gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpAMRDepay *rtpamrdepay;
const gint *frame_size;
GstBuffer *outbuf = NULL;
gint payload_len;
GstRTPBuffer rtp = { NULL };
GstMapInfo map;
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
@ -298,8 +297,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
else
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,
* no robust sorting, no interleaving data is to be depayloaded */
{
@ -308,13 +305,13 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gint amr_len;
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 */
if (payload_len < 2)
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
* a new encoding mode.
@ -419,7 +416,7 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* we can set the duration because each packet is 20 milliseconds */
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. */
GST_DEBUG_OBJECT (depayload, "marker bit was set");
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
@ -429,7 +426,6 @@ gst_rtp_amr_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_buffer_get_size (outbuf));
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -466,7 +462,6 @@ wrong_length_2:
bad_packet:
{
/* no fatal error */
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -56,7 +56,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
static GstBuffer *gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_bv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -82,7 +82,7 @@ gst_rtp_bv_depay_class_init (GstRTPBVDepayClass * klass)
"Extracts BroadcomVoice audio from RTP packets (RFC 4298)",
"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;
}
@ -155,22 +155,18 @@ wrong_rate:
}
static GstBuffer *
gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_bv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf;
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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (marker && outbuf) {
/* mark start of talkspurt with RESYNC */

View file

@ -65,7 +65,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
static GstBuffer *gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_celt_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -95,7 +95,7 @@ gst_rtp_celt_depay_class_init (GstRtpCELTDepayClass * klass)
"Extracts CELT audio from RTP packets",
"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;
}
@ -193,7 +193,7 @@ no_clockrate:
}
static GstBuffer *
gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf = NULL;
guint8 *payload;
@ -203,28 +203,25 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GstClockTime framesize_ns = 0, timestamp;
guint n = 0;
GstRtpCELTDepay *rtpceltdepay;
GstRTPBuffer rtp = { NULL, };
rtpceltdepay = GST_RTP_CELT_DEPAY (depayload);
clock_rate = depayload->clock_rate;
frame_size = rtpceltdepay->frame_size;
framesize_ns = gst_util_uint64_scale_int (frame_size, GST_SECOND, clock_rate);
timestamp = GST_BUFFER_PTS (buf);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
timestamp = GST_BUFFER_PTS (rtp->buffer);
GST_LOG_OBJECT (depayload,
"got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d",
gst_buffer_get_size (buf), gst_rtp_buffer_get_marker (&rtp),
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&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_LOG_OBJECT (depayload, "got clock-rate=%d, frame_size=%d, "
"_ns=%" GST_TIME_FORMAT ", timestamp=%" GST_TIME_FORMAT, clock_rate,
frame_size, GST_TIME_ARGS (framesize_ns), GST_TIME_ARGS (timestamp));
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
/* first count how many bytes are consumed by the size headers and make offset
* point to the first data byte */
@ -249,7 +246,7 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
total_size += s + 1;
} 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;
if (frame_size != -1 && clock_rate != -1) {
@ -263,7 +260,6 @@ gst_rtp_celt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_base_depayload_push (depayload, outbuf);
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
}

View file

@ -75,7 +75,7 @@ static GstStateChangeReturn
gst_rtp_dv_depay_change_state (GstElement * element, GstStateChange transition);
static GstBuffer *gst_rtp_dv_depay_process (GstRTPBaseDepayload * base,
GstBuffer * in);
GstRTPBuffer * rtp);
static gboolean gst_rtp_dv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -106,7 +106,7 @@ gst_rtp_dv_depay_class_init (GstRTPDVDepayClass * klass)
"Depayloads DV from RTP packets (RFC 3189)",
"Marcel Moreaux <marcelm@spacelabs.nl>, Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process =
gstrtpbasedepayload_class->process_rtp_packet =
GST_DEBUG_FUNCPTR (gst_rtp_dv_depay_process);
gstrtpbasedepayload_class->set_caps =
GST_DEBUG_FUNCPTR (gst_rtp_dv_depay_setcaps);
@ -286,7 +286,7 @@ calculate_difblock_location (guint8 * block)
* NTSC.
*/
static GstBuffer *
gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
{
GstBuffer *out = NULL;
guint8 *payload;
@ -294,16 +294,13 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
guint payload_len, location;
GstRTPDVDepay *dvdepay = GST_RTP_DV_DEPAY (base);
gboolean marker;
GstRTPBuffer rtp = { NULL, };
GstMapInfo map;
gst_rtp_buffer_map (in, GST_MAP_READ, &rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
marker = gst_rtp_buffer_get_marker (rtp);
/* Check if the received packet contains (the start of) a new frame, we do
* this by checking the RTP timestamp. */
rtp_ts = gst_rtp_buffer_get_timestamp (&rtp);
rtp_ts = gst_rtp_buffer_get_timestamp (rtp);
/* we cannot copy the packet yet if the marker is set, we will do that below
* after taking out the data */
@ -317,8 +314,8 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
}
/* Extract the payload */
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
/* copy all DIF chunks in their place. */
gst_buffer_map (dvdepay->acc, &map, GST_MAP_READWRITE);
@ -350,7 +347,6 @@ gst_rtp_dv_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
payload += 80;
payload_len -= 80;
}
gst_rtp_buffer_unmap (&rtp);
gst_buffer_unmap (dvdepay->acc, &map);
if (marker) {

View file

@ -66,7 +66,7 @@ G_DEFINE_TYPE (GstRtpG722Depay, gst_rtp_g722_depay,
static gboolean gst_rtp_g722_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_g722_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_g722_depay_class_init (GstRtpG722DepayClass * klass)
@ -91,7 +91,7 @@ gst_rtp_g722_depay_class_init (GstRtpG722DepayClass * klass)
"Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->set_caps = gst_rtp_g722_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_g722_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_g722_depay_process;
}
static void
@ -214,28 +214,24 @@ no_clockrate:
}
static GstBuffer *
gst_rtp_g722_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_g722_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpG722Depay *rtpg722depay;
GstBuffer *outbuf;
gint payload_len;
gboolean marker;
GstRTPBuffer rtp = { NULL };
rtpg722depay = GST_RTP_G722_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)
goto empty_packet;
GST_DEBUG_OBJECT (rtpg722depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker && outbuf) {
/* mark talk spurt with RESYNC */
@ -249,7 +245,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpg722depay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -75,7 +75,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_g723_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_g723_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
#define gst_rtp_g723_depay_parent_class parent_class
G_DEFINE_TYPE (GstRtpG723Depay, gst_rtp_g723_depay,
@ -103,7 +103,7 @@ gst_rtp_g723_depay_class_init (GstRtpG723DepayClass * klass)
"Extracts G.723 audio from RTP packets (RFC 3551)",
"Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_g723_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_g723_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_g723_depay_setcaps;
}
@ -171,19 +171,16 @@ wrong_clock_rate:
static GstBuffer *
gst_rtp_g723_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_g723_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpG723Depay *rtpg723depay;
GstBuffer *outbuf = NULL;
gint payload_len;
gboolean marker;
GstRTPBuffer rtp = { NULL };
rtpg723depay = GST_RTP_G723_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);
/* At least 4 bytes */
if (payload_len < 4)
@ -191,9 +188,8 @@ gst_rtp_g723_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_LOG_OBJECT (rtpg723depay, "payload len %d", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker) {
/* marker bit starts talkspurt */
@ -215,7 +211,6 @@ too_small:
bad_packet:
{
/* no fatal error */
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -82,7 +82,7 @@ static void gst_rtp_g726_depay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static GstBuffer *gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_g726_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -122,7 +122,7 @@ gst_rtp_g726_depay_class_init (GstRtpG726DepayClass * klass)
"Extracts G.726 audio from RTP packets",
"Axis Communications <dev-gstreamer@axis.com>");
gstrtpbasedepayload_class->process = gst_rtp_g726_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_g726_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_g726_depay_setcaps;
}
@ -207,26 +207,23 @@ unknown_encoding:
static GstBuffer *
gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpG726Depay *depay;
GstBuffer *outbuf = NULL;
gboolean marker;
GstRTPBuffer rtp = { NULL };
depay = GST_RTP_G726_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READWRITE, &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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
if (depay->aal2 || depay->force_aal2) {
/* AAL2, we can just copy the bytes */
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (!outbuf)
goto bad_len;
} else {
@ -234,10 +231,10 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint len;
GstMapInfo map;
in = gst_rtp_buffer_get_payload (&rtp);
len = gst_rtp_buffer_get_payload_len (&rtp);
in = gst_rtp_buffer_get_payload (rtp);
len = gst_rtp_buffer_get_payload_len (rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (!outbuf)
goto bad_len;
outbuf = gst_buffer_make_writable (outbuf);
@ -334,8 +331,6 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_buffer_unmap (outbuf, &map);
}
gst_rtp_buffer_unmap (&rtp);
if (marker) {
/* mark start of talkspurt with RESYNC */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_RESYNC);
@ -345,10 +340,8 @@ gst_rtp_g726_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
bad_len:
{
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}
static void

View file

@ -73,7 +73,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
static gboolean gst_rtp_g729_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
#define gst_rtp_g729_depay_parent_class parent_class
G_DEFINE_TYPE (GstRtpG729Depay, gst_rtp_g729_depay,
@ -101,7 +101,7 @@ gst_rtp_g729_depay_class_init (GstRtpG729DepayClass * klass)
"Extracts G.729 audio from RTP packets (RFC 3551)",
"Laurent Glayal <spglegle@yahoo.fr>");
gstrtpbasedepayload_class->process = gst_rtp_g729_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_g729_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_g729_depay_setcaps;
}
@ -168,19 +168,16 @@ wrong_clock_rate:
}
static GstBuffer *
gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpG729Depay *rtpg729depay;
GstBuffer *outbuf = NULL;
gint payload_len;
gboolean marker;
GstRTPBuffer rtp = { NULL };
rtpg729depay = GST_RTP_G729_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);
/* At least 2 bytes (CNG from G729 Annex B) */
if (payload_len < 2) {
@ -195,10 +192,8 @@ gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_LOG_OBJECT (rtpg729depay, "G729 payload contains CNG frame");
}
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker) {
/* marker bit starts talkspurt */
@ -214,7 +209,6 @@ gst_rtp_g729_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
bad_packet:
{
/* no fatal error */
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -57,7 +57,7 @@ static GstStaticPadTemplate gst_rtp_gsm_depay_sink_template =
);
static GstBuffer *gst_rtp_gsm_depay_process (GstRTPBaseDepayload * _depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_gsm_depay_setcaps (GstRTPBaseDepayload * _depayload,
GstCaps * caps);
@ -82,7 +82,7 @@ gst_rtp_gsm_depay_class_init (GstRTPGSMDepayClass * klass)
"RTP GSM depayloader", "Codec/Depayloader/Network/RTP",
"Extracts GSM audio from RTP packets", "Zeeshan Ali <zeenix@gmail.com>");
gstrtpbase_depayload_class->process = gst_rtp_gsm_depay_process;
gstrtpbase_depayload_class->process_rtp_packet = gst_rtp_gsm_depay_process;
gstrtpbase_depayload_class->set_caps = gst_rtp_gsm_depay_setcaps;
GST_DEBUG_CATEGORY_INIT (rtpgsmdepay_debug, "rtpgsmdepay", 0,
@ -117,23 +117,18 @@ gst_rtp_gsm_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_gsm_depay_process (GstRTPBaseDepayload * _depayload, GstBuffer * buf)
gst_rtp_gsm_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf = NULL;
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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (marker && outbuf) {
/* mark start of talkspurt with RESYNC */

View file

@ -59,7 +59,7 @@ static void gst_rtp_gst_depay_reset (GstRtpGSTDepay * rtpgstdepay, gboolean
static gboolean gst_rtp_gst_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass)
@ -91,7 +91,7 @@ gst_rtp_gst_depay_class_init (GstRtpGSTDepayClass * klass)
gstrtpbasedepayload_class->handle_event = gst_rtp_gst_depay_handle_event;
gstrtpbasedepayload_class->set_caps = gst_rtp_gst_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_gst_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_gst_depay_process;
}
static void
@ -397,30 +397,27 @@ store_event (GstRtpGSTDepay * rtpgstdepay, GstEvent * event)
}
static GstBuffer *
gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpGSTDepay *rtpgstdepay;
GstBuffer *subbuf, *outbuf = NULL;
gint payload_len;
guint8 *payload;
guint CV, frag_offset, avail, offset;
GstRTPBuffer rtp = { NULL };
rtpgstdepay = GST_RTP_GST_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 <= 8)
goto empty_packet;
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_WARNING_OBJECT (rtpgstdepay, "DISCONT, clear adapter");
gst_adapter_clear (rtpgstdepay->adapter);
}
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
/* strip off header
*
@ -440,11 +437,11 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
goto wrong_frag;
/* subbuffer skipping the 8 header bytes */
subbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 8, -1);
subbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 8, -1);
gst_adapter_push (rtpgstdepay->adapter, subbuf);
offset = 0;
if (gst_rtp_buffer_get_marker (&rtp)) {
if (gst_rtp_buffer_get_marker (rtp)) {
guint avail;
GstCaps *outcaps;
@ -525,7 +522,6 @@ gst_rtp_gst_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
outbuf = NULL;
}
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
@ -534,13 +530,11 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpgstdepay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
wrong_frag:
{
gst_adapter_clear (rtpgstdepay->adapter);
gst_rtp_buffer_unmap (&rtp);
GST_LOG_OBJECT (rtpgstdepay, "wrong fragment, skipping");
return NULL;
}
@ -548,14 +542,12 @@ no_caps:
{
GST_WARNING_OBJECT (rtpgstdepay, "failed to parse caps");
gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
no_event:
{
GST_WARNING_OBJECT (rtpgstdepay, "failed to parse event");
gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
missing_caps:
@ -563,7 +555,6 @@ missing_caps:
GST_ELEMENT_WARNING (rtpgstdepay, STREAM, DECODE,
("Missing caps %u.", CV), (NULL));
gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -79,7 +79,7 @@ G_DEFINE_TYPE (GstRtpH261Depay, gst_rtp_h261_depay,
#define parent_class gst_rtp_h261_depay_parent_class
static GstBuffer *
gst_rtp_h261_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_h261_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpH261Depay *depay;
GstBuffer *outbuf = NULL;
@ -88,28 +88,24 @@ gst_rtp_h261_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
const guint header_len = GST_RTP_H261_PAYLOAD_HEADER_LEN;
gboolean marker;
GstRtpH261PayHeader *header;
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
depay = GST_RTP_H261_DEPAY (depayload);
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_DEBUG_OBJECT (depay, "Discont buffer, flushing adapter");
gst_adapter_clear (depay->adapter);
depay->leftover = NO_LEFTOVER;
depay->start = FALSE;
}
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
marker = gst_rtp_buffer_get_marker (rtp);
if (payload_len < 4) {
GST_WARNING_OBJECT (depay,
"Dropping packet with payload length invalid length");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
@ -148,12 +144,12 @@ gst_rtp_h261_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
if (header->ebit == 0) {
/* H.261 stream ends on byte boundary, take entire packet */
gst_adapter_push (depay->adapter,
gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len, payload_len));
gst_rtp_buffer_get_payload_subbuffer (rtp, header_len, payload_len));
} else {
/* Take the entire buffer except for the last byte, which will be kept to
* merge with next packet */
gst_adapter_push (depay->adapter,
gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len,
gst_rtp_buffer_get_payload_subbuffer (rtp, header_len,
payload_len - 1));
depay->leftover = payload[payload_len - 1] & (0xFF << header->ebit);
}
@ -186,7 +182,6 @@ skip:
depay->start = TRUE;
}
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
}
@ -270,7 +265,7 @@ gst_rtp_h261_depay_class_init (GstRtpH261DepayClass * klass)
"Extracts H261 video from RTP packets (RFC 4587)",
"Stian Selnes <stian@pexip.com>");
gstrtpbasedepayload_class->process = gst_rtp_h261_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_h261_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_h261_depay_setcaps;
gobject_class->dispose = gst_rtp_h261_depay_dispose;

View file

@ -77,7 +77,7 @@ static GstStateChangeReturn gst_rtp_h263_depay_change_state (GstElement *
element, GstStateChange transition);
static GstBuffer *gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
gboolean gst_rtp_h263_depay_setcaps (GstRTPBaseDepayload * filter,
GstCaps * caps);
@ -110,7 +110,7 @@ gst_rtp_h263_depay_class_init (GstRtpH263DepayClass * klass)
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>, "
"Edward Hervey <bilboed@bilboed.com>");
gstrtpbasedepayload_class->process = gst_rtp_h263_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_h263_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_h263_depay_setcaps;
}
@ -204,7 +204,7 @@ gst_rtp_h263_depay_setcaps (GstRTPBaseDepayload * filter, GstCaps * caps)
}
static GstBuffer *
gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpH263Depay *rtph263depay;
GstBuffer *outbuf;
@ -214,12 +214,11 @@ gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint SBIT, EBIT;
gboolean F, P, M;
gboolean I;
GstRTPBuffer rtp = { NULL };
rtph263depay = GST_RTP_H263_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_LOG_OBJECT (depayload, "Discont buffer, flushing adapter");
gst_adapter_clear (rtph263depay->adapter);
rtph263depay->offset = 0;
@ -227,12 +226,10 @@ gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
rtph263depay->start = FALSE;
}
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
M = gst_rtp_buffer_get_marker (&rtp);
M = gst_rtp_buffer_get_marker (rtp);
if (payload_len < 1)
goto too_small;
@ -346,13 +343,13 @@ gst_rtp_h263_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GstBuffer *tmp;
/* Take the entire buffer */
tmp = gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len, payload_len);
tmp = gst_rtp_buffer_get_payload_subbuffer (rtp, header_len, payload_len);
gst_adapter_push (rtph263depay->adapter, tmp);
} else {
GstBuffer *tmp;
/* Take the entire buffer except for the last byte */
tmp = gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len,
tmp = gst_rtp_buffer_get_payload_subbuffer (rtp, header_len,
payload_len - 1);
gst_adapter_push (rtph263depay->adapter, tmp);
@ -395,7 +392,6 @@ skip:
rtph263depay->start = TRUE;
}
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
@ -403,7 +399,6 @@ too_small:
{
GST_ELEMENT_WARNING (rtph263depay, STREAM, DECODE,
("Packet payload was too small"), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -89,7 +89,7 @@ static GstStateChangeReturn gst_rtp_h263p_depay_change_state (GstElement *
element, GstStateChange transition);
static GstBuffer *gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
gboolean gst_rtp_h263p_depay_setcaps (GstRTPBaseDepayload * filter,
GstCaps * caps);
@ -118,7 +118,7 @@ gst_rtp_h263p_depay_class_init (GstRtpH263PDepayClass * klass)
"Extracts H263/+/++ video from RTP packets (RFC 4629)",
"Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_h263p_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_h263p_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_h263p_depay_setcaps;
GST_DEBUG_CATEGORY_INIT (rtph263pdepay_debug, "rtph263pdepay", 0,
@ -230,7 +230,8 @@ no_caps:
}
static GstBuffer *
gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstRtpH263PDepay *rtph263pdepay;
GstBuffer *outbuf;
@ -239,28 +240,25 @@ gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gboolean P, V, M;
guint header_len;
guint8 PLEN, PEBIT;
GstRTPBuffer rtp = { NULL };
rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
gst_adapter_clear (rtph263pdepay->adapter);
rtph263pdepay->wait_start = TRUE;
}
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);
header_len = 2;
if (payload_len < header_len)
goto too_small;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
M = gst_rtp_buffer_get_marker (&rtp);
M = gst_rtp_buffer_get_marker (rtp);
/* 0 1
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
@ -316,7 +314,7 @@ gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_LOG_OBJECT (depayload, "Frame complete");
outbuf =
gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len, payload_len);
gst_rtp_buffer_get_payload_subbuffer (rtp, header_len, payload_len);
gst_adapter_push (rtph263pdepay->adapter, outbuf);
outbuf = NULL;
@ -330,18 +328,15 @@ gst_rtp_h263p_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_buffer_memset (padbuf, 0, 0, padlen);
outbuf = gst_buffer_append (outbuf, padbuf);
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
} else {
/* frame not completed: store in adapter */
GST_LOG_OBJECT (depayload, "Frame incomplete, storing %d", payload_len);
outbuf =
gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len, payload_len);
gst_rtp_buffer_get_payload_subbuffer (rtp, header_len, payload_len);
gst_adapter_push (rtph263pdepay->adapter, outbuf);
gst_rtp_buffer_unmap (&rtp);
}
return NULL;
@ -349,13 +344,11 @@ too_small:
{
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
("Packet payload was too small"), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
waiting_start:
{
GST_DEBUG_OBJECT (rtph263pdepay, "waiting for picture start");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -85,7 +85,7 @@ static GstStateChangeReturn gst_rtp_h264_depay_change_state (GstElement *
element, GstStateChange transition);
static GstBuffer *gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_h264_depay_setcaps (GstRTPBaseDepayload * filter,
GstCaps * caps);
static gboolean gst_rtp_h264_depay_handle_event (GstRTPBaseDepayload * depay,
@ -115,7 +115,7 @@ gst_rtp_h264_depay_class_init (GstRtpH264DepayClass * klass)
"Wim Taymans <wim.taymans@gmail.com>");
gstelement_class->change_state = gst_rtp_h264_depay_change_state;
gstrtpbasedepayload_class->process = gst_rtp_h264_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_h264_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_h264_depay_setcaps;
gstrtpbasedepayload_class->handle_event = gst_rtp_h264_depay_handle_event;
}
@ -828,17 +828,16 @@ gst_rtp_h264_push_fragmentation_unit (GstRtpH264Depay * rtph264depay,
}
static GstBuffer *
gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpH264Depay *rtph264depay;
GstBuffer *outbuf = NULL;
guint8 nal_unit_type;
GstRTPBuffer rtp = { NULL };
rtph264depay = GST_RTP_H264_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
gst_adapter_clear (rtph264depay->adapter);
rtph264depay->wait_start = TRUE;
rtph264depay->current_fu_type = 0;
@ -854,13 +853,11 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GstClockTime timestamp;
gboolean marker;
timestamp = GST_BUFFER_PTS (buf);
timestamp = GST_BUFFER_PTS (rtp->buffer);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
GST_DEBUG_OBJECT (rtph264depay, "receiving %d bytes", payload_len);
@ -1080,7 +1077,6 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
break;
}
}
gst_rtp_buffer_unmap (&rtp);
}
return outbuf;
@ -1089,27 +1085,23 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
empty_packet:
{
GST_DEBUG_OBJECT (rtph264depay, "empty packet");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
undefined_type:
{
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
(NULL), ("Undefined packet type"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
waiting_start:
{
GST_DEBUG_OBJECT (rtph264depay, "waiting for start");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
not_implemented:
{
GST_ELEMENT_ERROR (rtph264depay, STREAM, FORMAT,
(NULL), ("NAL unit type %d not supported yet", nal_unit_type));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -65,7 +65,7 @@ static void gst_ilbc_depay_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static GstBuffer *gst_rtp_ilbc_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_ilbc_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -120,7 +120,7 @@ gst_rtp_ilbc_depay_class_init (GstRTPiLBCDepayClass * klass)
"Extracts iLBC audio from RTP packets (RFC 3952)",
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>");
gstrtpbasedepayload_class->process = gst_rtp_ilbc_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_ilbc_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_ilbc_depay_setcaps;
}
@ -170,23 +170,18 @@ gst_rtp_ilbc_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_ilbc_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_ilbc_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf;
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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (marker && outbuf) {
/* mark start of talkspurt with RESYNC */

View file

@ -78,7 +78,7 @@ gst_rtp_j2k_depay_change_state (GstElement * element,
static gboolean gst_rtp_j2k_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_j2k_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_j2k_depay_class_init (GstRtpJ2KDepayClass * klass)
@ -109,7 +109,7 @@ gst_rtp_j2k_depay_class_init (GstRtpJ2KDepayClass * klass)
gstelement_class->change_state = gst_rtp_j2k_depay_change_state;
gstrtpbasedepayload_class->set_caps = gst_rtp_j2k_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_j2k_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_j2k_depay_process;
GST_DEBUG_CATEGORY_INIT (rtpj2kdepay_debug, "rtpj2kdepay", 0,
"J2K Video RTP Depayloader");
@ -426,27 +426,24 @@ done:
}
static GstBuffer *
gst_rtp_j2k_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_j2k_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpJ2KDepay *rtpj2kdepay;
guint8 *payload;
guint MHF, mh_id, frag_offset, tile, payload_len, j2klen;
gint gap;
guint32 rtptime;
GstRTPBuffer rtp = { NULL };
rtpj2kdepay = GST_RTP_J2K_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
/* we need at least a header */
if (payload_len < 8)
goto empty_packet;
rtptime = gst_rtp_buffer_get_timestamp (&rtp);
rtptime = gst_rtp_buffer_get_timestamp (rtp);
/* new timestamp marks new frame */
if (rtpj2kdepay->last_rtptime != rtptime) {
@ -543,7 +540,7 @@ gst_rtp_j2k_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
/* and push in pu adapter */
GST_DEBUG_OBJECT (rtpj2kdepay, "push pu of size %u in adapter", j2klen);
pu_frag = gst_rtp_buffer_get_payload_subbuffer (&rtp, 8, -1);
pu_frag = gst_rtp_buffer_get_payload_subbuffer (rtp, 8, -1);
gst_adapter_push (rtpj2kdepay->pu_adapter, pu_frag);
if (MHF & 2) {
@ -556,12 +553,11 @@ gst_rtp_j2k_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
/* marker bit finishes the frame */
if (gst_rtp_buffer_get_marker (&rtp)) {
if (gst_rtp_buffer_get_marker (rtp)) {
GST_DEBUG_OBJECT (rtpj2kdepay, "marker set, last buffer");
/* then flush frame */
gst_rtp_j2k_depay_flush_frame (depayload);
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
@ -570,7 +566,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpj2kdepay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
wrong_mh_id:
@ -579,7 +574,6 @@ wrong_mh_id:
("Invalid mh_id %u, expected %u", mh_id, rtpj2kdepay->last_mh_id),
(NULL));
gst_rtp_j2k_depay_clear_pu (rtpj2kdepay);
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -77,7 +77,7 @@ static GstStateChangeReturn gst_rtp_jpeg_depay_change_state (GstElement *
static gboolean gst_rtp_jpeg_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_jpeg_depay_class_init (GstRtpJPEGDepayClass * klass)
@ -105,7 +105,7 @@ gst_rtp_jpeg_depay_class_init (GstRtpJPEGDepayClass * klass)
gstelement_class->change_state = gst_rtp_jpeg_depay_change_state;
gstrtpbasedepayload_class->set_caps = gst_rtp_jpeg_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_jpeg_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_jpeg_depay_process;
GST_DEBUG_CATEGORY_INIT (rtpjpegdepay_debug, "rtpjpegdepay", 0,
"JPEG Video RTP Depayloader");
@ -487,7 +487,7 @@ gst_rtp_jpeg_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpJPEGDepay *rtpjpegdepay;
GstBuffer *outbuf;
@ -498,23 +498,21 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint type, width, height;
guint16 dri, precision, length;
guint8 *qtable;
GstRTPBuffer rtp = { NULL };
rtpjpegdepay = GST_RTP_JPEG_DEPAY (depayload);
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_DEBUG_OBJECT (depayload, "DISCONT, reset adapter");
gst_adapter_clear (rtpjpegdepay->adapter);
rtpjpegdepay->discont = TRUE;
}
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 < 8)
goto empty_packet;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
header_len = 0;
/* 0 1 2 3
@ -674,11 +672,11 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* take JPEG data, push in the adapter */
GST_DEBUG_OBJECT (rtpjpegdepay, "pushing data at offset %d", header_len);
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, header_len, -1);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, header_len, -1);
gst_adapter_push (rtpjpegdepay->adapter, outbuf);
outbuf = NULL;
if (gst_rtp_buffer_get_marker (&rtp)) {
if (gst_rtp_buffer_get_marker (rtp)) {
guint avail;
guint8 end[2];
GstMapInfo map;
@ -717,8 +715,6 @@ gst_rtp_jpeg_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG_OBJECT (rtpjpegdepay, "returning %u bytes", avail);
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -726,20 +722,17 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpjpegdepay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_dimension:
{
GST_ELEMENT_WARNING (rtpjpegdepay, STREAM, FORMAT,
("Invalid Dimension %dx%d.", width, height), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
no_qtable:
{
GST_WARNING_OBJECT (rtpjpegdepay, "no qtable");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_packet:
@ -747,7 +740,6 @@ invalid_packet:
GST_WARNING_OBJECT (rtpjpegdepay, "invalid packet");
gst_adapter_flush (rtpjpegdepay->adapter,
gst_adapter_available (rtpjpegdepay->adapter));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -67,7 +67,7 @@ static GstStateChangeReturn gst_rtp_klv_depay_change_state (GstElement *
static gboolean gst_rtp_klv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void gst_rtp_klv_depay_reset (GstRtpKlvDepay * klvdepay);
@ -98,7 +98,7 @@ gst_rtp_klv_depay_class_init (GstRtpKlvDepayClass * klass)
rtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
rtpbasedepayload_class->set_caps = gst_rtp_klv_depay_setcaps;
rtpbasedepayload_class->process = gst_rtp_klv_depay_process;
rtpbasedepayload_class->process_rtp_packet = gst_rtp_klv_depay_process;
}
static void
@ -252,10 +252,9 @@ incomplete_klv_packet:
/* We're trying to be pragmatic here, not quite as strict as the spec wants
* us to be with regard to marker bits and resyncing after packet loss */
static GstBuffer *
gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpKlvDepay *klvdepay = GST_RTP_KLV_DEPAY (depayload);
GstRTPBuffer rtp = { NULL };
GstBuffer *payload, *outbuf = NULL;
gboolean marker, start = FALSE, maybe_start;
guint32 rtp_ts;
@ -263,19 +262,17 @@ gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint payload_len;
/* Ignore DISCONT on first buffer and on buffers following a discont */
if (GST_BUFFER_IS_DISCONT (buf) && klvdepay->last_rtp_ts != -1) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer) && klvdepay->last_rtp_ts != -1) {
GST_WARNING_OBJECT (klvdepay, "DISCONT, need to resync");
gst_rtp_klv_depay_reset (klvdepay);
}
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);
/* marker bit signals last fragment of a KLV unit */
marker = gst_rtp_buffer_get_marker (&rtp);
marker = gst_rtp_buffer_get_marker (rtp);
seq = gst_rtp_buffer_get_seq (&rtp);
seq = gst_rtp_buffer_get_seq (rtp);
/* packet directly after one with marker bit set => start */
start = klvdepay->last_marker_seq != -1
@ -283,7 +280,7 @@ gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* deduce start of new KLV unit in case sender doesn't set marker bits
* (it's not like the spec is ambiguous about that, but what can you do) */
rtp_ts = gst_rtp_buffer_get_timestamp (&rtp);
rtp_ts = gst_rtp_buffer_get_timestamp (rtp);
maybe_start = klvdepay->last_rtp_ts == -1 || klvdepay->last_rtp_ts != rtp_ts;
@ -295,7 +292,7 @@ gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint64 v_len;
gsize len_size;
data = gst_rtp_buffer_get_payload (&rtp);
data = gst_rtp_buffer_get_payload (rtp);
if (GST_READ_UINT32_BE (data) == 0x060e2b34 &&
klv_get_vlen (data + 16, payload_len - 16, &v_len, &len_size)) {
if (16 + len_size + v_len == payload_len) {
@ -332,7 +329,7 @@ gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
if (start && !marker)
outbuf = gst_rtp_klv_depay_process_data (klvdepay);
payload = gst_rtp_buffer_get_payload_buffer (&rtp);
payload = gst_rtp_buffer_get_payload_buffer (rtp);
gst_adapter_push (klvdepay->adapter, payload);
if (marker)
@ -340,8 +337,6 @@ gst_rtp_klv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
done:
gst_rtp_buffer_unmap (&rtp);
return outbuf;
}

View file

@ -66,7 +66,7 @@ G_DEFINE_TYPE (GstRtpMP1SDepay, gst_rtp_mp1s_depay,
static gboolean gst_rtp_mp1s_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mp1s_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_mp1s_depay_class_init (GstRtpMP1SDepayClass * klass)
@ -77,7 +77,7 @@ gst_rtp_mp1s_depay_class_init (GstRtpMP1SDepayClass * klass)
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_mp1s_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp1s_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_mp1s_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -118,14 +118,11 @@ gst_rtp_mp1s_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mp1s_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mp1s_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL };
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf)
GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %"

View file

@ -74,7 +74,7 @@ G_DEFINE_TYPE (GstRtpMP2TDepay, gst_rtp_mp2t_depay,
static gboolean gst_rtp_mp2t_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mp2t_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void gst_rtp_mp2t_depay_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@ -92,7 +92,7 @@ gst_rtp_mp2t_depay_class_init (GstRtpMP2TDepayClass * klass)
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_mp2t_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp2t_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_mp2t_depay_setcaps;
gobject_class->set_property = gst_rtp_mp2t_depay_set_property;
@ -146,17 +146,15 @@ gst_rtp_mp2t_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mp2t_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mp2t_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMP2TDepay *rtpmp2tdepay;
GstBuffer *outbuf;
gint payload_len, leftover;
GstRTPBuffer rtp = { NULL };
rtpmp2tdepay = GST_RTP_MP2T_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 (G_UNLIKELY (payload_len <= rtpmp2tdepay->skip_first_bytes))
goto empty_packet;
@ -179,10 +177,9 @@ gst_rtp_mp2t_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
outbuf =
gst_rtp_buffer_get_payload_subbuffer (&rtp,
gst_rtp_buffer_get_payload_subbuffer (rtp,
rtpmp2tdepay->skip_first_bytes, payload_len);
gst_rtp_buffer_unmap (&rtp);
if (outbuf)
GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
@ -194,7 +191,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
(NULL), ("Packet was empty"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -64,7 +64,7 @@ static void gst_rtp_mp4a_depay_finalize (GObject * object);
static gboolean gst_rtp_mp4a_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static GstStateChangeReturn gst_rtp_mp4a_depay_change_state (GstElement *
element, GstStateChange transition);
@ -85,7 +85,7 @@ gst_rtp_mp4a_depay_class_init (GstRtpMP4ADepayClass * klass)
gstelement_class->change_state = gst_rtp_mp4a_depay_change_state;
gstrtpbasedepayload_class->process = gst_rtp_mp4a_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp4a_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_mp4a_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -293,30 +293,28 @@ gst_rtp_mp4a_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMP4ADepay *rtpmp4adepay;
GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL };
GstMapInfo map;
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
gst_adapter_clear (rtpmp4adepay->adapter);
}
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
outbuf = gst_buffer_make_writable (outbuf);
GST_BUFFER_PTS (outbuf) = GST_BUFFER_PTS (buf);
GST_BUFFER_PTS (outbuf) = GST_BUFFER_PTS (rtp->buffer);
gst_adapter_push (rtpmp4adepay->adapter, outbuf);
/* RTP marker bit indicates the last packet of the AudioMuxElement => create
* and push a buffer */
if (gst_rtp_buffer_get_marker (&rtp)) {
if (gst_rtp_buffer_get_marker (rtp)) {
guint avail;
guint i;
guint8 *data;
@ -394,7 +392,6 @@ gst_rtp_mp4a_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_buffer_unmap (outbuf, &map);
gst_buffer_unref (outbuf);
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
/* ERRORS */
@ -404,7 +401,6 @@ wrong_size:
("Packet did not validate"), ("wrong packet size"));
gst_buffer_unmap (outbuf, &map);
gst_buffer_unref (outbuf);
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -134,7 +134,7 @@ static void gst_rtp_mp4g_depay_finalize (GObject * object);
static gboolean gst_rtp_mp4g_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_mp4g_depay_handle_event (GstRTPBaseDepayload * filter,
GstEvent * event);
@ -157,7 +157,7 @@ gst_rtp_mp4g_depay_class_init (GstRtpMP4GDepayClass * klass)
gstelement_class->change_state = gst_rtp_mp4g_depay_change_state;
gstrtpbasedepayload_class->process = gst_rtp_mp4g_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp4g_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_mp4g_depay_setcaps;
gstrtpbasedepayload_class->handle_event = gst_rtp_mp4g_depay_handle_event;
@ -418,22 +418,21 @@ gst_rtp_mp4g_depay_queue (GstRtpMP4GDepay * rtpmp4gdepay, GstBuffer * outbuf)
}
static GstBuffer *
gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMP4GDepay *rtpmp4gdepay;
GstBuffer *outbuf = NULL;
GstClockTime timestamp;
GstRTPBuffer rtp = { NULL };
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
if (GST_BUFFER_IS_DISCONT (rtp->buffer)) {
GST_DEBUG_OBJECT (rtpmp4gdepay, "received DISCONT");
gst_adapter_clear (rtpmp4gdepay->adapter);
}
timestamp = GST_BUFFER_PTS (buf);
timestamp = GST_BUFFER_PTS (rtp->buffer);
{
gint payload_len, payload_AU;
@ -443,14 +442,13 @@ gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint AU_size, AU_index, AU_index_delta, payload_AU_size;
gboolean M;
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
GST_DEBUG_OBJECT (rtpmp4gdepay, "received payload of %d", payload_len);
rtptime = gst_rtp_buffer_get_timestamp (&rtp);
M = gst_rtp_buffer_get_marker (&rtp);
rtptime = gst_rtp_buffer_get_timestamp (rtp);
M = gst_rtp_buffer_get_marker (rtp);
if (rtpmp4gdepay->sizelength > 0) {
gint num_AU_headers, AU_headers_bytes, i;
@ -650,7 +648,7 @@ gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* collect stuff in the adapter, strip header from payload and push in
* the adapter */
outbuf =
gst_rtp_buffer_get_payload_subbuffer (&rtp, payload_AU, AU_size);
gst_rtp_buffer_get_payload_subbuffer (rtp, payload_AU, AU_size);
gst_adapter_push (rtpmp4gdepay->adapter, outbuf);
if (M) {
@ -682,7 +680,7 @@ gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
} else {
/* push complete buffer in adapter */
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 0, payload_len);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 0, payload_len);
gst_adapter_push (rtpmp4gdepay->adapter, outbuf);
/* if this was the last packet of the VOP, create and push a buffer */
@ -696,13 +694,11 @@ gst_rtp_mp4g_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG ("gst_rtp_mp4g_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
gst_rtp_buffer_unmap (&rtp);
return outbuf;
}
}
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
/* ERRORS */
@ -710,7 +706,6 @@ short_payload:
{
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
("Packet payload was too short."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -61,7 +61,7 @@ static void gst_rtp_mp4v_depay_finalize (GObject * object);
static gboolean gst_rtp_mp4v_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static GstStateChangeReturn gst_rtp_mp4v_depay_change_state (GstElement *
element, GstStateChange transition);
@ -81,7 +81,7 @@ gst_rtp_mp4v_depay_class_init (GstRtpMP4VDepayClass * klass)
gstelement_class->change_state = gst_rtp_mp4v_depay_change_state;
gstrtpbasedepayload_class->process = gst_rtp_mp4v_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mp4v_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_mp4v_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -159,23 +159,21 @@ gst_rtp_mp4v_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMP4VDepay *rtpmp4vdepay;
GstBuffer *pbuf, *outbuf = NULL;
GstRTPBuffer rtp = { NULL };
gboolean marker;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf))
if (GST_BUFFER_IS_DISCONT (rtp->buffer))
gst_adapter_clear (rtpmp4vdepay->adapter);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
pbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
marker = gst_rtp_buffer_get_marker (&rtp);
gst_rtp_buffer_unmap (&rtp);
pbuf = gst_rtp_buffer_get_payload_buffer (rtp);
marker = gst_rtp_buffer_get_marker (rtp);
gst_rtp_buffer_unmap (rtp);
gst_adapter_push (rtpmp4vdepay->adapter, pbuf);

View file

@ -55,7 +55,7 @@ G_DEFINE_TYPE (GstRtpMPADepay, gst_rtp_mpa_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
static gboolean gst_rtp_mpa_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_mpa_depay_class_init (GstRtpMPADepayClass * klass)
@ -80,7 +80,7 @@ gst_rtp_mpa_depay_class_init (GstRtpMPADepayClass * klass)
"Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->set_caps = gst_rtp_mpa_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_mpa_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mpa_depay_process;
}
static void
@ -111,11 +111,10 @@ gst_rtp_mpa_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMPADepay *rtpmpadepay;
GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL };
gint payload_len;
#if 0
guint8 *payload;
@ -125,9 +124,7 @@ gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
rtpmpadepay = GST_RTP_MPA_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 <= 4)
goto empty_packet;
@ -146,8 +143,8 @@ gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
#endif
/* subbuffer skipping the 4 header bytes */
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 4, -1);
marker = gst_rtp_buffer_get_marker (&rtp);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 4, -1);
marker = gst_rtp_buffer_get_marker (rtp);
if (marker) {
/* mark start of talkspurt with RESYNC */
@ -157,8 +154,6 @@ gst_rtp_mpa_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
"gst_rtp_mpa_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT "",
gst_buffer_get_size (outbuf));
gst_rtp_buffer_unmap (&rtp);
/* FIXME, we can push half mpeg frames when they are split over multiple
* RTP packets */
return outbuf;
@ -168,7 +163,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
("Empty Payload."), (NULL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -77,7 +77,7 @@ static GstStateChangeReturn gst_rtp_mpa_robust_change_state (GstElement *
static gboolean gst_rtp_mpa_robust_depay_setcaps (GstRTPBaseDepayload *
depayload, GstCaps * caps);
static GstBuffer *gst_rtp_mpa_robust_depay_process (GstRTPBaseDepayload *
depayload, GstBuffer * buf);
depayload, GstRTPBuffer * rtp);
static void
gst_rtp_mpa_robust_depay_finalize (GObject * object)
@ -122,7 +122,8 @@ gst_rtp_mpa_robust_depay_class_init (GstRtpMPARobustDepayClass * klass)
"Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>");
gstrtpbasedepayload_class->set_caps = gst_rtp_mpa_robust_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_mpa_robust_depay_process;
gstrtpbasedepayload_class->process_rtp_packet =
gst_rtp_mpa_robust_depay_process;
}
static void
@ -641,7 +642,7 @@ gst_rtp_mpa_robust_depay_submit_adu (GstRtpMPARobustDepay * rtpmpadepay,
static GstBuffer *
gst_rtp_mpa_robust_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf)
GstRTPBuffer * rtp)
{
GstRtpMPARobustDepay *rtpmpadepay;
gint payload_len, offset;
@ -649,19 +650,17 @@ gst_rtp_mpa_robust_depay_process (GstRTPBaseDepayload * depayload,
gboolean cont, dtype;
guint av, size;
GstClockTime timestamp;
GstRTPBuffer rtp = { NULL };
GstBuffer *buf;
rtpmpadepay = GST_RTP_MPA_ROBUST_DEPAY (depayload);
timestamp = GST_BUFFER_PTS (buf);
timestamp = GST_BUFFER_PTS (rtp->buffer);
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 <= 1)
goto short_read;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
offset = 0;
GST_LOG_OBJECT (rtpmpadepay, "payload_len: %d", payload_len);
@ -701,7 +700,7 @@ gst_rtp_mpa_robust_depay_process (GstRTPBaseDepayload * depayload,
GST_LOG_OBJECT (rtpmpadepay, "offset %d has cont: %d, dtype: %d, size: %d",
offset, cont, dtype, size);
buf = gst_rtp_buffer_get_payload_subbuffer (&rtp, offset,
buf = gst_rtp_buffer_get_payload_subbuffer (rtp, offset,
MIN (size, payload_len));
if (cont) {
@ -745,7 +744,6 @@ gst_rtp_mpa_robust_depay_process (GstRTPBaseDepayload * depayload,
/* timestamp applies to first payload, no idea for subsequent ones */
timestamp = GST_CLOCK_TIME_NONE;
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
@ -754,7 +752,6 @@ short_read:
{
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
(NULL), ("Packet contains invalid data"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -57,7 +57,7 @@ G_DEFINE_TYPE (GstRtpMPVDepay, gst_rtp_mpv_depay, GST_TYPE_RTP_BASE_DEPAYLOAD);
static gboolean gst_rtp_mpv_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void
gst_rtp_mpv_depay_class_init (GstRtpMPVDepayClass * klass)
@ -79,7 +79,7 @@ gst_rtp_mpv_depay_class_init (GstRtpMPVDepayClass * klass)
"Wim Taymans <wim.taymans@gmail.com>");
gstrtpbasedepayload_class->set_caps = gst_rtp_mpv_depay_setcaps;
gstrtpbasedepayload_class->process = gst_rtp_mpv_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_mpv_depay_process;
GST_DEBUG_CATEGORY_INIT (rtpmpvdepay_debug, "rtpmpvdepay", 0,
"MPEG Video RTP Depayloader");
@ -114,23 +114,20 @@ gst_rtp_mpv_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpMPVDepay *rtpmpvdepay;
GstBuffer *outbuf = NULL;
GstRTPBuffer rtp = { NULL };
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
{
gint payload_len, payload_header;
guint8 *payload;
guint8 T;
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_header = 0;
if (payload_len <= 4)
@ -169,7 +166,7 @@ gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
payload += 4;
}
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, payload_header, -1);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, payload_header, -1);
if (outbuf) {
GST_DEBUG_OBJECT (rtpmpvdepay,
@ -178,8 +175,6 @@ gst_rtp_mpv_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -187,8 +182,6 @@ empty_packet:
{
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
(NULL), ("Empty payload."));
gst_rtp_buffer_unmap (&rtp);
gst_buffer_unref (buf);
return NULL;
}
}

View file

@ -60,7 +60,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
static GstBuffer *gst_rtp_pcma_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_pcma_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -87,7 +87,7 @@ gst_rtp_pcma_depay_class_init (GstRtpPcmaDepayClass * klass)
"Extracts PCMA audio from RTP packets",
"Edgard Lima <edgard.lima@indt.org.br>, Zeeshan Ali <zeenix@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_pcma_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_pcma_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_pcma_depay_setcaps;
}
@ -124,24 +124,20 @@ gst_rtp_pcma_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_pcma_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_pcma_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf = NULL;
gboolean marker;
guint len;
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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
len = gst_rtp_buffer_get_payload_len (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
len = gst_rtp_buffer_get_payload_len (rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf) {
GST_BUFFER_DURATION (outbuf) =
@ -153,7 +149,6 @@ gst_rtp_pcma_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
}
return outbuf;
}

View file

@ -61,7 +61,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
static GstBuffer *gst_rtp_pcmu_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_pcmu_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -88,7 +88,7 @@ gst_rtp_pcmu_depay_class_init (GstRtpPcmuDepayClass * klass)
"Extracts PCMU audio from RTP packets",
"Edgard Lima <edgard.lima@indt.org.br>, Zeeshan Ali <zeenix@gmail.com>");
gstrtpbasedepayload_class->process = gst_rtp_pcmu_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_pcmu_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_pcmu_depay_setcaps;
}
@ -125,24 +125,20 @@ gst_rtp_pcmu_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_pcmu_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_pcmu_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstBuffer *outbuf = NULL;
guint len;
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_buffer_get_size (buf), marker,
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&rtp));
gst_buffer_get_size (rtp->buffer), marker,
gst_rtp_buffer_get_timestamp (rtp), gst_rtp_buffer_get_seq (rtp));
len = gst_rtp_buffer_get_payload_len (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
len = gst_rtp_buffer_get_payload_len (rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf) {
GST_BUFFER_DURATION (outbuf) =

View file

@ -74,7 +74,7 @@ static void gst_rtp_qcelp_depay_finalize (GObject * object);
static gboolean gst_rtp_qcelp_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
#define gst_rtp_qcelp_depay_parent_class parent_class
G_DEFINE_TYPE (GstRtpQCELPDepay, gst_rtp_qcelp_depay,
@ -93,7 +93,7 @@ gst_rtp_qcelp_depay_class_init (GstRtpQCELPDepayClass * klass)
gobject_class->finalize = gst_rtp_qcelp_depay_finalize;
gstrtpbasedepayload_class->process = gst_rtp_qcelp_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_qcelp_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_qcelp_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -248,7 +248,8 @@ create_erasure_buffer (GstRtpQCELPDepay * depay)
}
static GstBuffer *
gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstRtpQCELPDepay *depay;
GstBuffer *outbuf;
@ -256,20 +257,17 @@ gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint payload_len, offset, index;
guint8 *payload;
guint LLL, NNN;
GstRTPBuffer rtp = { NULL };
depay = GST_RTP_QCELP_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 < 2)
goto too_small;
timestamp = GST_BUFFER_PTS (buf);
timestamp = GST_BUFFER_PTS (rtp->buffer);
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
/* 0 1 2 3 4 5 6 7
* +-+-+-+-+-+-+-+-+
@ -351,7 +349,7 @@ gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
outbuf = create_erasure_buffer (depay);
} else {
/* each frame goes into its buffer */
outbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, offset, frame_len);
outbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, offset, frame_len);
}
GST_BUFFER_PTS (outbuf) = timestamp;
@ -393,7 +391,6 @@ gst_rtp_qcelp_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
flush_packets (depay);
}
gst_rtp_buffer_unmap (&rtp);
return NULL;
/* ERRORS */
@ -401,28 +398,24 @@ too_small:
{
GST_ELEMENT_WARNING (depay, STREAM, DECODE,
(NULL), ("QCELP RTP payload too small (%d)", payload_len));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_lll:
{
GST_ELEMENT_WARNING (depay, STREAM, DECODE,
(NULL), ("QCELP RTP invalid LLL received (%d)", LLL));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_nnn:
{
GST_ELEMENT_WARNING (depay, STREAM, DECODE,
(NULL), ("QCELP RTP invalid NNN received (%d)", NNN));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_frame:
{
GST_ELEMENT_WARNING (depay, STREAM, DECODE,
(NULL), ("QCELP RTP invalid frame received"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -60,7 +60,7 @@ static GstStateChangeReturn gst_rtp_qdm2_depay_change_state (GstElement *
element, GstStateChange transition);
static GstBuffer *gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
gboolean gst_rtp_qdm2_depay_setcaps (GstRTPBaseDepayload * filter,
GstCaps * caps);
@ -75,7 +75,7 @@ gst_rtp_qdm2_depay_class_init (GstRtpQDM2DepayClass * klass)
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_qdm2_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_qdm2_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_qdm2_depay_setcaps;
gobject_class->finalize = gst_rtp_qdm2_depay_finalize;
@ -223,12 +223,11 @@ add_packet (GstRtpQDM2Depay * depay, guint32 pid, guint32 len, guint8 * data)
}
static GstBuffer *
gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpQDM2Depay *rtpqdm2depay;
GstBuffer *outbuf = NULL;
guint16 seq;
GstRTPBuffer rtp = { NULL };
rtpqdm2depay = GST_RTP_QDM2_DEPAY (depayload);
@ -238,20 +237,19 @@ gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint avail;
guint pos = 0;
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 < 3)
goto bad_packet;
payload = gst_rtp_buffer_get_payload (&rtp);
seq = gst_rtp_buffer_get_seq (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
seq = gst_rtp_buffer_get_seq (rtp);
if (G_UNLIKELY (seq != rtpqdm2depay->nextseq)) {
GST_DEBUG ("GAP in sequence number, Resetting data !");
/* Flush previous data */
flush_data (rtpqdm2depay);
/* And store new timestamp */
rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp;
rtpqdm2depay->timestamp = GST_BUFFER_PTS (buf);
rtpqdm2depay->timestamp = GST_BUFFER_PTS (rtp->buffer);
/* And that previous data will be pushed at the bottom */
}
rtpqdm2depay->nextseq = seq + 1;
@ -273,7 +271,7 @@ gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG ("Headers");
/* Store the incoming timestamp */
rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp;
rtpqdm2depay->timestamp = GST_BUFFER_PTS (buf);
rtpqdm2depay->timestamp = GST_BUFFER_PTS (rtp->buffer);
/* flush the internal data if needed */
flush_data (rtpqdm2depay);
if (G_UNLIKELY (!rtpqdm2depay->configured)) {
@ -362,7 +360,6 @@ gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
}
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -370,7 +367,6 @@ bad_packet:
{
GST_ELEMENT_WARNING (rtpqdm2depay, STREAM, DECODE,
(NULL), ("Packet was too short"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -59,7 +59,7 @@ static void gst_rtp_sbc_depay_finalize (GObject * object);
static gboolean gst_rtp_sbc_depay_setcaps (GstRTPBaseDepayload * base,
GstCaps * caps);
static GstBuffer *gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base,
GstBuffer * in);
GstRTPBuffer * rtp);
static void
gst_rtp_sbc_depay_class_init (GstRtpSbcDepayClass * klass)
@ -72,7 +72,7 @@ gst_rtp_sbc_depay_class_init (GstRtpSbcDepayClass * klass)
gobject_class->finalize = gst_rtp_sbc_depay_finalize;
gstbasertpdepayload_class->set_caps = gst_rtp_sbc_depay_setcaps;
gstbasertpdepayload_class->process = gst_rtp_sbc_depay_process;
gstbasertpdepayload_class->process_rtp_packet = gst_rtp_sbc_depay_process;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_rtp_sbc_depay_src_template));
@ -189,30 +189,27 @@ bad_caps:
}
static GstBuffer *
gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base, GstRTPBuffer * rtp)
{
GstRtpSbcDepay *depay = GST_RTP_SBC_DEPAY (base);
GstBuffer *data = NULL;
GstRTPBuffer rtp = { NULL };
gboolean fragment, start, last;
guint8 nframes;
guint8 *payload;
guint payload_len;
gst_rtp_buffer_map (in, GST_MAP_READ, &rtp);
GST_LOG_OBJECT (depay, "Got %" G_GSIZE_FORMAT " bytes",
gst_buffer_get_size (in));
gst_buffer_get_size (rtp->buffer));
if (gst_rtp_buffer_get_marker (&rtp)) {
if (gst_rtp_buffer_get_marker (rtp)) {
/* Marker isn't supposed to be set */
GST_WARNING_OBJECT (depay, "Marker bit was set");
goto bad_packet;
}
payload = gst_rtp_buffer_get_payload (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
fragment = payload[0] & 0x80;
start = payload[0] & 0x40;
@ -222,7 +219,7 @@ gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
payload += 1;
payload_len -= 1;
data = gst_rtp_buffer_get_payload_subbuffer (&rtp, 1, -1);
data = gst_rtp_buffer_get_payload_subbuffer (rtp, 1, -1);
if (fragment) {
/* Got a packet with a fragment */
@ -270,7 +267,6 @@ gst_rtp_sbc_depay_process (GstRTPBaseDepayload * base, GstBuffer * in)
}
out:
gst_rtp_buffer_unmap (&rtp);
return data;
bad_packet:

View file

@ -47,7 +47,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
);
static GstBuffer *gst_rtp_siren_depay_process (GstRTPBaseDepayload *
depayload, GstBuffer * buf);
depayload, GstRTPBuffer * rtp);
static gboolean gst_rtp_siren_depay_setcaps (GstRTPBaseDepayload *
depayload, GstCaps * caps);
@ -62,7 +62,7 @@ G_DEFINE_TYPE (GstRTPSirenDepay, gst_rtp_siren_depay,
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_siren_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_siren_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_siren_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -101,14 +101,12 @@ gst_rtp_siren_depay_setcaps (GstRTPBaseDepayload * depayload, GstCaps * caps)
}
static GstBuffer *
gst_rtp_siren_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_siren_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstBuffer *outbuf;
GstRTPBuffer rtp = { NULL };
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
return outbuf;
}

View file

@ -58,7 +58,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
);
static GstBuffer *gst_rtp_speex_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_speex_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
@ -74,7 +74,7 @@ gst_rtp_speex_depay_class_init (GstRtpSPEEXDepayClass * klass)
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_speex_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_speex_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_speex_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -195,21 +195,18 @@ no_clockrate:
}
static GstBuffer *
gst_rtp_speex_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_speex_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstBuffer *outbuf = NULL;
GstRTPBuffer rtp = { NULL };
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
GST_DEBUG ("process : got %" G_GSIZE_FORMAT " bytes, mark %d ts %u seqn %d",
gst_buffer_get_size (buf),
gst_rtp_buffer_get_marker (&rtp),
gst_rtp_buffer_get_timestamp (&rtp), gst_rtp_buffer_get_seq (&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));
/* nothing special to be done */
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_rtp_buffer_unmap (&rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (rtp);
if (outbuf)
GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND;

View file

@ -56,7 +56,7 @@ static GstStateChangeReturn gst_rtp_sv3v_depay_change_state (GstElement *
element, GstStateChange transition);
static GstBuffer *gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
gboolean gst_rtp_sv3v_depay_setcaps (GstRTPBaseDepayload * filter,
GstCaps * caps);
@ -71,7 +71,7 @@ gst_rtp_sv3v_depay_class_init (GstRtpSV3VDepayClass * klass)
gstelement_class = (GstElementClass *) klass;
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
gstrtpbasedepayload_class->process = gst_rtp_sv3v_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_sv3v_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_sv3v_depay_setcaps;
gobject_class->finalize = gst_rtp_sv3v_depay_finalize;
@ -125,7 +125,7 @@ gst_rtp_sv3v_depay_setcaps (GstRTPBaseDepayload * filter, GstCaps * caps)
}
static GstBuffer *
gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp)
{
GstRtpSV3VDepay *rtpsv3vdepay;
static struct
@ -147,17 +147,15 @@ gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gboolean C, S, E;
GstBuffer *outbuf = NULL;
guint16 seq;
GstRTPBuffer rtp = { NULL };
rtpsv3vdepay = GST_RTP_SV3V_DEPAY (depayload);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
/* flush on sequence number gaps */
seq = gst_rtp_buffer_get_seq (&rtp);
seq = gst_rtp_buffer_get_seq (rtp);
GST_DEBUG ("timestamp %" GST_TIME_FORMAT ", sequence number:%d",
GST_TIME_ARGS (GST_BUFFER_PTS (buf)), seq);
GST_TIME_ARGS (GST_BUFFER_PTS (rtp->buffer)), seq);
if (seq != rtpsv3vdepay->nextseq) {
GST_DEBUG ("Sequence discontinuity, clearing adapter");
@ -165,13 +163,13 @@ gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
rtpsv3vdepay->nextseq = seq + 1;
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload_len = gst_rtp_buffer_get_payload_len (rtp);
if (payload_len < 3)
goto bad_packet;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
M = gst_rtp_buffer_get_marker (&rtp);
M = gst_rtp_buffer_get_marker (rtp);
/* This is all a guess:
* 1 1 1 1 1 1
@ -255,7 +253,7 @@ gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
GST_DEBUG ("Storing incoming payload");
/* store data in adapter, stip off 2 bytes header */
tmpbuf = gst_rtp_buffer_get_payload_subbuffer (&rtp, 2, -1);
tmpbuf = gst_rtp_buffer_get_payload_subbuffer (rtp, 2, -1);
gst_adapter_push (rtpsv3vdepay->adapter, tmpbuf);
if (G_UNLIKELY (M)) {
@ -269,7 +267,6 @@ gst_rtp_sv3v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
}
beach:
gst_rtp_buffer_unmap (&rtp);
return outbuf;
/* ERRORS */
@ -277,7 +274,6 @@ bad_packet:
{
GST_ELEMENT_WARNING (rtpsv3vdepay, STREAM, DECODE,
(NULL), ("Packet was too short"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -66,7 +66,7 @@ G_DEFINE_TYPE (GstRtpTheoraDepay, gst_rtp_theora_depay,
static gboolean gst_rtp_theora_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static gboolean gst_rtp_theora_depay_packet_lost (GstRTPBaseDepayload *
depayload, GstEvent * event);
@ -85,7 +85,7 @@ gst_rtp_theora_depay_class_init (GstRtpTheoraDepayClass * klass)
gobject_class->finalize = gst_rtp_theora_depay_finalize;
gstrtpbasedepayload_class->process = gst_rtp_theora_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_theora_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_theora_depay_setcaps;
gstrtpbasedepayload_class->packet_lost = gst_rtp_theora_depay_packet_lost;
@ -388,7 +388,8 @@ gst_rtp_theora_depay_switch_codebook (GstRtpTheoraDepay * rtptheoradepay,
}
static GstBuffer *
gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstRtpTheoraDepay *rtptheoradepay;
GstBuffer *outbuf;
@ -397,14 +398,11 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint8 *payload, *to_free = NULL;
guint32 header, ident;
guint8 F, TDT, packets;
GstRTPBuffer rtp = { NULL };
guint length;
rtptheoradepay = GST_RTP_THEORA_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);
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
@ -412,7 +410,7 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
if (G_UNLIKELY (payload_len < 4))
goto packet_short;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
header = GST_READ_UINT32_BE (payload);
/*
@ -477,7 +475,7 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* first assembled packet, reuse 2 bytes to store the length */
headerskip = (F == 1 ? 4 : 6);
/* skip header and length. */
vdata = gst_rtp_buffer_get_payload_subbuffer (&rtp, headerskip, -1);
vdata = gst_rtp_buffer_get_payload_subbuffer (rtp, headerskip, -1);
GST_DEBUG_OBJECT (depayload, "assemble theora packet");
gst_adapter_push (rtptheoradepay->adapter, vdata);
@ -576,7 +574,6 @@ gst_rtp_theora_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
out:
no_output:
gst_rtp_buffer_unmap (&rtp);
g_free (to_free);
return NULL;

View file

@ -63,7 +63,7 @@ G_DEFINE_TYPE (GstRtpVorbisDepay, gst_rtp_vorbis_depay,
static gboolean gst_rtp_vorbis_depay_setcaps (GstRTPBaseDepayload * depayload,
GstCaps * caps);
static GstBuffer *gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static void gst_rtp_vorbis_depay_finalize (GObject * object);
@ -85,7 +85,7 @@ gst_rtp_vorbis_depay_class_init (GstRtpVorbisDepayClass * klass)
gstelement_class->change_state = gst_rtp_vorbis_depay_change_state;
gstrtpbasedepayload_class->process = gst_rtp_vorbis_depay_process;
gstrtpbasedepayload_class->process_rtp_packet = gst_rtp_vorbis_depay_process;
gstrtpbasedepayload_class->set_caps = gst_rtp_vorbis_depay_setcaps;
gst_element_class_add_pad_template (gstelement_class,
@ -436,7 +436,8 @@ gst_rtp_vorbis_depay_switch_codebook (GstRtpVorbisDepay * rtpvorbisdepay,
}
static GstBuffer *
gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload,
GstRTPBuffer * rtp)
{
GstRtpVorbisDepay *rtpvorbisdepay;
GstBuffer *outbuf;
@ -445,14 +446,11 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
guint8 *payload, *to_free = NULL;
guint32 header, ident;
guint8 F, VDT, packets;
GstRTPBuffer rtp = { NULL };
guint length;
rtpvorbisdepay = GST_RTP_VORBIS_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);
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
@ -460,7 +458,7 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
if (G_UNLIKELY (payload_len < 4))
goto packet_short;
payload = gst_rtp_buffer_get_payload (&rtp);
payload = gst_rtp_buffer_get_payload (rtp);
header = GST_READ_UINT32_BE (payload);
/*
@ -528,7 +526,7 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
/* first assembled packet, reuse 2 bytes to store the length */
headerskip = (F == 1 ? 4 : 6);
/* skip header and length. */
vdata = gst_rtp_buffer_get_payload_subbuffer (&rtp, headerskip, -1);
vdata = gst_rtp_buffer_get_payload_subbuffer (rtp, headerskip, -1);
GST_DEBUG_OBJECT (depayload, "assemble vorbis packet");
gst_adapter_push (rtpvorbisdepay->adapter, vdata);
@ -619,13 +617,10 @@ gst_rtp_vorbis_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
g_free (to_free);
gst_rtp_buffer_unmap (&rtp);
return NULL;
no_output:
{
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
/* ERORRS */
@ -633,27 +628,23 @@ switch_failed:
{
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Could not switch codebooks"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
packet_short:
{
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet was too short (%d < 4)", payload_len));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
ignore_reserved:
{
GST_WARNING_OBJECT (rtpvorbisdepay, "reserved VDT ignored");
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
length_short:
{
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet contains invalid data"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
invalid_configuration:
@ -661,7 +652,6 @@ invalid_configuration:
/* fatal, as we otherwise risk carrying on without output */
GST_ELEMENT_ERROR (rtpvorbisdepay, STREAM, DECODE,
(NULL), ("Packet contains invalid configuration"));
gst_rtp_buffer_unmap (&rtp);
return NULL;
}
}

View file

@ -33,7 +33,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp8_depay_debug);
static void gst_rtp_vp8_depay_dispose (GObject * object);
static GstBuffer *gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depayload,
GstBuffer * buf);
GstRTPBuffer * rtp);
static GstStateChangeReturn gst_rtp_vp8_depay_change_state (GstElement *
element, GstStateChange transition);
static gboolean gst_rtp_vp8_depay_handle_event (GstRTPBaseDepayload * depay,
@ -86,7 +86,7 @@ gst_rtp_vp8_depay_class_init (GstRtpVP8DepayClass * gst_rtp_vp8_depay_class)
element_class->change_state = gst_rtp_vp8_depay_change_state;
depay_class->process = gst_rtp_vp8_depay_process;
depay_class->process_rtp_packet = gst_rtp_vp8_depay_process;
depay_class->handle_event = gst_rtp_vp8_depay_handle_event;
GST_DEBUG_CATEGORY_INIT (gst_rtp_vp8_depay_debug, "rtpvp8depay", 0,
@ -109,29 +109,27 @@ gst_rtp_vp8_depay_dispose (GObject * object)
}
static GstBuffer *
gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstRTPBuffer * rtp)
{
GstRtpVP8Depay *self = GST_RTP_VP8_DEPAY (depay);
GstBuffer *payload;
guint8 *data;
guint hdrsize;
guint size;
GstRTPBuffer rtpbuffer = GST_RTP_BUFFER_INIT;
if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (buf))) {
if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (rtp->buffer))) {
GST_LOG_OBJECT (self, "Discontinuity, flushing adapter");
gst_adapter_clear (self->adapter);
self->started = FALSE;
}
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtpbuffer);
size = gst_rtp_buffer_get_payload_len (&rtpbuffer);
size = gst_rtp_buffer_get_payload_len (rtp);
/* At least one header and one vp8 byte */
if (G_UNLIKELY (size < 2))
goto too_small;
data = gst_rtp_buffer_get_payload (&rtpbuffer);
data = gst_rtp_buffer_get_payload (rtp);
if (G_UNLIKELY (!self->started)) {
/* Check if this is the start of a VP8 frame, otherwise bail */
@ -167,11 +165,11 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
if (G_UNLIKELY (hdrsize >= size))
goto too_small;
payload = gst_rtp_buffer_get_payload_subbuffer (&rtpbuffer, hdrsize, -1);
payload = gst_rtp_buffer_get_payload_subbuffer (rtp, hdrsize, -1);
gst_adapter_push (self->adapter, payload);
/* Marker indicates that it was the last rtp packet for this frame */
if (gst_rtp_buffer_get_marker (&rtpbuffer)) {
if (gst_rtp_buffer_get_marker (rtp)) {
GstBuffer *out;
guint8 header[10];
@ -181,7 +179,6 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
gst_adapter_available (self->adapter));
self->started = FALSE;
gst_rtp_buffer_unmap (&rtpbuffer);
/* mark keyframes */
out = gst_buffer_make_writable (out);
@ -231,7 +228,6 @@ gst_rtp_vp8_depay_process (GstRTPBaseDepayload * depay, GstBuffer * buf)
}
done:
gst_rtp_buffer_unmap (&rtpbuffer);
return NULL;
too_small: