Skip over extensions in RTP header. Ticket #388

This commit is contained in:
Andreas Öman 2011-03-01 18:16:08 +01:00
parent c365f235cc
commit 98975cf4b3

View 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;