summaryrefslogtreecommitdiffstats
path: root/gst/rtp/gstrtph263pdepay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2008-05-02 12:44:18 +0000
committerWim Taymans <wim.taymans@gmail.com>2008-05-02 12:44:18 +0000
commit34f916abbd9284552603810e3a0d4abf3e831dbd (patch)
tree1e50b288f260a6a97f88b42bffae62e3eda6f394 /gst/rtp/gstrtph263pdepay.c
parentca2bc1840a53ad7eba34177cfb23bc75f244e9b8 (diff)
gst/rtp/gstrtph263pdepay.c: Add some more debug info and guard against small payloads.
Original commit message from CVS: * gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_process): Add some more debug info and guard against small payloads. * gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_process): Set duration on outgoing buffers because we can.
Diffstat (limited to 'gst/rtp/gstrtph263pdepay.c')
-rw-r--r--gst/rtp/gstrtph263pdepay.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gst/rtp/gstrtph263pdepay.c b/gst/rtp/gstrtph263pdepay.c
index da25acc5..97f06845 100644
--- a/gst/rtp/gstrtph263pdepay.c
+++ b/gst/rtp/gstrtph263pdepay.c
@@ -248,6 +248,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* flush remaining data on discont */
if (GST_BUFFER_IS_DISCONT (buf)) {
+ GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
gst_adapter_clear (rtph263pdepay->adapter);
rtph263pdepay->wait_start = TRUE;
}
@@ -256,7 +257,6 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
gint payload_len;
guint8 *payload;
gboolean P, V, M;
- guint32 timestamp;
guint header_len;
guint8 PLEN, PEBIT;
@@ -281,6 +281,9 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
PLEN = ((payload[0] & 0x1) << 5) | (payload[1] >> 3);
PEBIT = payload[1] & 0x7;
+ GST_LOG_OBJECT (depayload, "P %d, V %d, PLEN %d, PEBIT %d", P, V, PLEN,
+ PEBIT);
+
if (V) {
header_len++;
}
@@ -292,6 +295,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
goto bad_packet;
if (P) {
+ /* FIXME, have to make the packet writable hear. Better to reset these
+ * bytes when we copy the packet below */
rtph263pdepay->wait_start = FALSE;
header_len -= 2;
payload[header_len] = 0;
@@ -301,19 +306,22 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
if (rtph263pdepay->wait_start)
goto waiting_start;
+ if (payload_len < header_len)
+ goto too_small;
+
/* FIXME do not ignore the VRC header (See RFC 2429 section 4.2) */
/* FIXME actually use the RTP picture header when it is lost in the network */
/* for now strip off header */
payload += header_len;
payload_len -= header_len;
- timestamp = gst_rtp_buffer_get_timestamp (buf);
-
if (M) {
/* frame is completed: append to previous, push it out */
guint len, padlen;
guint avail;
+ GST_LOG_OBJECT (depayload, "Frame complete");
+
avail = gst_adapter_available (rtph263pdepay->adapter);
len = avail + payload_len;
@@ -336,6 +344,8 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
/* frame not completed: store in adapter */
outbuf = gst_buffer_new_and_alloc (payload_len);
+ GST_LOG_OBJECT (depayload, "Frame incomplete, storing %d", payload_len);
+
memcpy (GST_BUFFER_DATA (outbuf), payload, payload_len);
gst_adapter_push (rtph263pdepay->adapter, outbuf);
@@ -349,6 +359,12 @@ bad_packet:
("Packet did not validate"), (NULL));
return NULL;
}
+too_small:
+ {
+ GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
+ ("Packet payload was too small"), (NULL));
+ return NULL;
+ }
waiting_start:
{
GST_DEBUG_OBJECT (rtph263pdepay, "waiting for picture start");