]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Add rtp_read callback, to forward headers to RTCP reader
authorAdrien CLERC <adrien@antipoul.fr>
Sun, 31 May 2015 13:41:47 +0000 (15:41 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 2 Jun 2015 13:38:15 +0000 (15:38 +0200)
src/input/mpegts/iptv/iptv_rtsp.c

index 51abbe63afa8c0d59520ed841d064ce4342a9111..d49391bc153f58393751bd6f1de6e0bf45e1f491 100644 (file)
@@ -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
  */