# HG changeset patch # User Mychaela Falconia # Date 1720423519 0 # Node ID e70e7b266f8949c942a3ce0d296ad98a866b04dc # Parent aa97e77e7de6b907f19e96694d8111c93a88240c hook in RTCP output diff -r aa97e77e7de6 -r e70e7b266f89 include/endp.h --- a/include/endp.h Mon Jul 08 07:17:38 2024 +0000 +++ b/include/endp.h Mon Jul 08 07:25:19 2024 +0000 @@ -37,7 +37,6 @@ struct twrtp_endp_rtcp_tx { uint32_t last_received; uint32_t last_expected; - uint16_t auto_rtcp_count; }; struct twrtp_endp_stats { @@ -68,6 +67,7 @@ uint8_t *sdes_buf; uint16_t sdes_len; uint16_t auto_rtcp_interval; + uint16_t auto_rtcp_count; /* always have to have stats */ struct twrtp_endp_stats stats; /* bool flags at the end for structure packing optimization */ diff -r aa97e77e7de6 -r e70e7b266f89 src/rtp_tx.c --- 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 #include #include +#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; }