diff src/rtp_tx.c @ 33:e70e7b266f89

hook in RTCP output
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 08 Jul 2024 07:25:19 +0000
parents defe58aa537c
children
line wrap: on
line diff
--- a/src/rtp_tx.c	Mon Jul 08 07:17:38 2024 +0000
+++ b/src/rtp_tx.c	Mon Jul 08 07:25:19 2024 +0000
@@ -15,6 +15,7 @@
 #include <themwi/rtp/endp.h>
 #include <themwi/rtp/rtp_basic_hdr.h>
 #include <themwi/rtp/twjit.h>
+#include "endp_internal.h"
 
 static uint32_t gen_timestamp(struct timespec *now,
 			      struct twrtp_jibuf_inst *twjit)
@@ -94,7 +95,17 @@
 	endp->stats.tx_rtp_pkt++;
 	endp->stats.tx_rtp_bytes += payload_len;
 
-	/* TODO: send RTCP if requested */
+	if (endp->auto_rtcp_interval) {
+		endp->auto_rtcp_count++;
+		if (endp->auto_rtcp_count >= endp->auto_rtcp_interval) {
+			endp->auto_rtcp_count = 0;
+			send_rtcp = true;
+		}
+	}
+	if (send_rtcp) {
+		_twrtp_endp_send_rtcp(endp, true, &now,
+				      endp->tx.ts - ts_quantum);
+	}
 
 	return 0;
 }