]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Skip over extensions in RTP header. Ticket #388
authorAndreas Öman <andreas@lonelycoder.com>
Tue, 1 Mar 2011 17:16:08 +0000 (18:16 +0100)
committerAndreas Öman <andreas@lonelycoder.com>
Tue, 1 Mar 2011 17:16:08 +0000 (18:16 +0100)
src/iptv_input.c

index 8a4b2bd7e9341bd405692b441999578a2be7b6b6..44938edc0cc95ba947ac68db65b806132be2d902 100644 (file)
@@ -124,7 +124,7 @@ iptv_ts_input(service_t *t, const uint8_t *tsb)
 static void *
 iptv_thread(void *aux)
 {
-  int nfds, fd, r, j;
+  int nfds, fd, r, j, hlen;
   uint8_t tsb[65536], *buf;
   struct epoll_event ev;
   service_t *t;
@@ -158,7 +158,17 @@ iptv_thread(void *aux)
       if((tsb[1] & 0x7f) != 33)
        continue;
       
-      int hlen = (tsb[0] & 0xf) * 4 + 12;
+      hlen = (tsb[0] & 0xf) * 4 + 12;
+
+      if(tsb[0] & 0x10) {
+       // Extension (X bit) == true
+
+       if(r < hlen + 4)
+         continue; // Packet size < hlen + extension header
+
+       // Skip over extension header (last 2 bytes of header is length)
+       hlen += ((tsb[hlen + 2] << 8) | tsb[hlen + 3]) * 4;
+      }
 
       if(r < hlen || (r - hlen) % 188 != 0)
        continue;