From: Adrien CLERC Date: Sun, 31 May 2015 13:41:47 +0000 (+0200) Subject: Add rtp_read callback, to forward headers to RTCP reader X-Git-Tag: v4.2.1~2387 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00a19f1b7c38258080c9aac30f59ee2fd3fb02f1;p=thirdparty%2Ftvheadend.git Add rtp_read callback, to forward headers to RTCP reader --- diff --git a/src/input/mpegts/iptv/iptv_rtsp.c b/src/input/mpegts/iptv/iptv_rtsp.c index 51abbe63a..d49391bc1 100644 --- a/src/input/mpegts/iptv/iptv_rtsp.c +++ b/src/input/mpegts/iptv/iptv_rtsp.c @@ -220,6 +220,32 @@ iptv_rtsp_stop pthread_mutex_lock(&iptv_lock); } +static void +iptv_rtp_header_callback ( iptv_mux_t *im, uint8_t *rtp, int len ) +{ + rtsp_priv_t *rp = im->im_data; + iptv_rtcp_info_t *rtcp_info = rp->rtcp_info; + ssize_t hlen; + + /* Basic headers checks */ + /* Version 2 */ + if ((rtp[0] & 0xC0) != 0x80) + return; + + /* Header length (4bytes per CSRC) */ + hlen = ((rtp[0] & 0xf) * 4) + 12; + if (rtp[0] & 0x10) { + if (len < hlen+4) + return; + hlen += ((rtp[hlen+2] << 8) | rtp[hlen+3]) * 4; + hlen += 4; + } + if (len < hlen || ((len - hlen) % 188) != 0) + return; + + rtcp_receiver_update(rtcp_info, rtp); +} + /* * Read data */