update for RTP buffer api changes

This commit is contained in:
Wim Taymans 2012-07-17 16:38:27 +02:00
parent d38ac43a27
commit 51371d26ee
7 changed files with 17 additions and 58 deletions

View file

@ -257,9 +257,6 @@ gst_rtp_xqt_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
if (!gst_rtp_buffer_validate (buf))
goto bad_packet;
if (GST_BUFFER_IS_DISCONT (buf)) {
/* discont, clear adapter and try to find a new packet start */
gst_adapter_clear (rtpxqtdepay->adapter);
@ -624,12 +621,6 @@ done:
gst_rtp_buffer_unmap (&rtp);
return outbuf;
bad_packet:
{
GST_ELEMENT_WARNING (rtpxqtdepay, STREAM, DECODE,
("Packet did not validate."), (NULL));
goto done;
}
need_resync:
{
GST_DEBUG_OBJECT (rtpxqtdepay, "waiting for marker");

View file

@ -127,9 +127,6 @@ gst_asteriskh263_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
asteriskh263 = GST_ASTERISK_H263 (parent);
if (!gst_rtp_buffer_validate (buf))
goto bad_packet;
{
gint payload_len;
guint8 *payload;
@ -140,7 +137,8 @@ gst_asteriskh263_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstRTPBuffer rtp = { NULL };
GstMapInfo map;
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
if (!gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp))
goto bad_packet;
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
payload = gst_rtp_buffer_get_payload (&rtp);

View file

@ -1255,12 +1255,11 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
jitterbuffer = GST_RTP_JITTER_BUFFER (parent);
if (G_UNLIKELY (!gst_rtp_buffer_validate (buffer)))
goto invalid_buffer;
priv = jitterbuffer->priv;
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
if (G_UNLIKELY (!gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp)))
goto invalid_buffer;
pt = gst_rtp_buffer_get_payload_type (&rtp);
seqnum = gst_rtp_buffer_get_seq (&rtp);
gst_rtp_buffer_unmap (&rtp);
@ -1529,7 +1528,7 @@ compute_elapsed (GstRtpJitterBuffer * jitterbuffer, GstBuffer * outbuf)
guint64 ext_time, elapsed;
guint32 rtp_time;
GstRtpJitterBufferPrivate *priv;
GstRTPBuffer rtp = { NULL, };
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
priv = jitterbuffer->priv;
gst_rtp_buffer_map (outbuf, GST_MAP_READ, &rtp);

View file

@ -354,10 +354,9 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
rtpdemux = GST_RTP_PT_DEMUX (parent);
if (!gst_rtp_buffer_validate (buf))
if (!gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp))
goto invalid_buffer;
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
pt = gst_rtp_buffer_get_payload_type (&rtp);
gst_rtp_buffer_unmap (&rtp);

View file

@ -580,10 +580,9 @@ gst_rtp_ssrc_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
demux = GST_RTP_SSRC_DEMUX (parent);
if (!gst_rtp_buffer_validate (buf))
if (!gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp))
goto invalid_payload;
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
ssrc = gst_rtp_buffer_get_ssrc (&rtp);
gst_rtp_buffer_unmap (&rtp);

View file

@ -1711,26 +1711,23 @@ rtp_session_process_rtp (RTPSession * sess, GstBuffer * buffer,
g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR);
g_return_val_if_fail (GST_IS_BUFFER (buffer), GST_FLOW_ERROR);
if (!gst_rtp_buffer_validate (buffer))
if (!gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp))
goto invalid_packet;
RTP_SESSION_LOCK (sess);
/* update arrival stats */
update_arrival_stats (sess, &arrival, TRUE, buffer, current_time,
running_time, -1);
/* ignore more RTP packets when we left the session */
if (sess->source->received_bye)
goto ignore;
/* update arrival stats */
update_arrival_stats (sess, &arrival, TRUE, buffer, current_time,
running_time, -1);
/* get SSRC and look up in session database */
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
ssrc = gst_rtp_buffer_get_ssrc (&rtp);
source = obtain_source (sess, ssrc, &created, &arrival, TRUE);
if (!source) {
gst_rtp_buffer_unmap (&rtp);
if (!source)
goto collision;
}
/* copy available csrc for later */
count = gst_rtp_buffer_get_csrc_count (&rtp);
@ -1811,14 +1808,15 @@ invalid_packet:
ignore:
{
RTP_SESSION_UNLOCK (sess);
gst_rtp_buffer_unmap (&rtp);
gst_buffer_unref (buffer);
clean_arrival_stats (&arrival);
GST_DEBUG ("ignoring RTP packet because we are leaving");
return GST_FLOW_OK;
}
collision:
{
RTP_SESSION_UNLOCK (sess);
gst_rtp_buffer_unmap (&rtp);
gst_buffer_unref (buffer);
clean_arrival_stats (&arrival);
GST_DEBUG ("ignoring packet because its collisioning");
@ -2454,26 +2452,11 @@ rtp_session_send_rtp (RTPSession * sess, gpointer data, gboolean is_list,
GstFlowReturn result;
RTPSource *source;
gboolean prevsender;
gboolean valid_packet;
guint64 oldrate;
g_return_val_if_fail (RTP_IS_SESSION (sess), GST_FLOW_ERROR);
g_return_val_if_fail (is_list || GST_IS_BUFFER (data), GST_FLOW_ERROR);
if (is_list) {
GstBufferList *blist = GST_BUFFER_LIST_CAST (data);
gint i, len = gst_buffer_list_length (blist);
valid_packet = TRUE;
for (i = 0; i < len; i++)
valid_packet &= gst_rtp_buffer_validate (gst_buffer_list_get (blist, i));
} else {
valid_packet = gst_rtp_buffer_validate (GST_BUFFER_CAST (data));
}
if (!valid_packet)
goto invalid_packet;
GST_LOG ("received RTP %s for sending", is_list ? "list" : "packet");
RTP_SESSION_LOCK (sess);
@ -2495,14 +2478,6 @@ rtp_session_send_rtp (RTPSession * sess, gpointer data, gboolean is_list,
RTP_SESSION_UNLOCK (sess);
return result;
/* ERRORS */
invalid_packet:
{
gst_mini_object_unref (GST_MINI_OBJECT_CAST (data));
GST_DEBUG ("invalid RTP packet received");
return GST_FLOW_OK;
}
}
static void

View file

@ -469,11 +469,9 @@ gst_rtp_dec_chain_rtp (GstPad * pad, GstObject * parent, GstBuffer * buffer)
GST_DEBUG_OBJECT (rtpdec, "got rtp packet");
if (!gst_rtp_buffer_validate (buffer))
if (!gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp))
goto bad_packet;
gst_rtp_buffer_map (buffer, GST_MAP_READ, &rtp);
ssrc = gst_rtp_buffer_get_ssrc (&rtp);
pt = gst_rtp_buffer_get_payload_type (&rtp);
gst_rtp_buffer_unmap (&rtp);