rtpvp8depay: Accept packets with only one byte of data
authorSjoerd Simons <sjoerd@luon.net>
Sun, 23 Jan 2011 17:02:38 +0000 (17:02 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Thu, 1 Nov 2012 20:53:47 +0000 (20:53 +0000)
When fragmenting partions it can happen that an RTP packet only caries 1
byte of RTP data.

gst/rtp/gstrtpvp8depay.c

index 79eee53..d9d2226 100644 (file)
@@ -121,6 +121,7 @@ gst_rtp_vp8_depay_process (GstBaseRTPDepayload * depay, GstBuffer * buf)
     self->started = FALSE;
   }
 
+  /* At least one header and one vp8 byte */
   if (G_UNLIKELY (size < 2))
     goto too_small;
 
@@ -140,13 +141,13 @@ gst_rtp_vp8_depay_process (GstBaseRTPDepayload * depay, GstBuffer * buf)
     for (; (data[offset] & 0x80) != 0; offset++) {
       /* should be at least one more pictureID byte and at least one byte in
        * the vp8 payload */
-      if (offset + 2 >= size)
+      if (G_UNLIKELY (offset + 2 >= size))
         goto too_small;
     }
     offset++;
   }
 
-  if (offset + 1 >= size)
+  if (G_UNLIKELY (offset >= size))
     goto too_small;
 
   payload = gst_rtp_buffer_get_payload_subbuffer (buf, offset, -1);