Commit 9b0cba1f authored by Ghislain MARY's avatar Ghislain MARY

Send RTCP XR packets according to the set intervals.

parent 86610e8f
......@@ -209,9 +209,12 @@ typedef struct _RtcpStream
uint32_t rtcp_report_snt_interval_s; /* the interval in timestamp unit for send path between rtcp report sent */
bool_t enabled; /*tells whether we can send RTCP packets */
OrtpRtcpXrConfiguration xr_conf;
uint32_t rtcp_xr_rcvr_rtt_interval;
uint32_t rtcp_xr_stat_summary_interval;
uint32_t rtcp_xr_voip_metrics_interval;
uint32_t last_rtcp_xr_rcvr_rtt_s; /* The time of the last RTCP XR rcvr rtt packet sent, in send timestamp unit */
uint32_t last_rtcp_xr_stat_summary_s; /* The time of the last RTCP XR stat summary packet sent, in send timestamp unit */
uint32_t last_rtcp_xr_voip_metrics_s; /* The time of the last RTCP XR voip metrics packet sent, in send timestamp unit */
uint32_t rtcp_xr_rcvr_rtt_interval; /* The interval in timestamp unit for RTCP XR rcvr rtt packet sending */
uint32_t rtcp_xr_stat_summary_interval; /* The interval in timestamp unit for RTCP XR stat summary packet sending */
uint32_t rtcp_xr_voip_metrics_interval; /* The interval in timestamp unit for RTCP XR voip metrics packet sending */
} RtcpStream;
typedef struct _RtpSession RtpSession;
......@@ -453,8 +456,8 @@ ORTP_PUBLIC mblk_t * rtp_session_pick_with_cseq (RtpSession * session, const uin
ORTP_PUBLIC void rtp_session_send_rtcp_xr_rcvr_rtt(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_rtcp_xr_dlrr(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_stat_summary(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_voip_metrics(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_rtcp_xr_stat_summary(RtpSession *session);
ORTP_PUBLIC void rtp_session_send_rtcp_xr_voip_metrics(RtpSession *session);
/*private */
......
......@@ -401,6 +401,27 @@ static void notify_sent_rtcp(RtpSession *session, mblk_t *rtcp){
}
}
static void rtp_session_rtcp_xr_process_send(RtpSession *session) {
RtpStream *st = &session->rtp;
RtcpStream *rtcp_st = &session->rtcp;
if ((rtcp_st->xr_conf.rcvr_rtt_mode != OrtpRtcpXrRcvrRttNone)
&& ((st->snd_last_ts - rtcp_st->last_rtcp_xr_rcvr_rtt_s) > rtcp_st->rtcp_xr_rcvr_rtt_interval)) {
rtcp_st->last_rtcp_xr_rcvr_rtt_s = st->snd_last_ts;
rtp_session_send_rtcp_xr_rcvr_rtt(session);
}
if ((rtcp_st->xr_conf.stat_summary_enabled == TRUE)
&& ((st->snd_last_ts - rtcp_st->last_rtcp_xr_stat_summary_s) > rtcp_st->rtcp_xr_stat_summary_interval)) {
rtcp_st->last_rtcp_xr_stat_summary_s = st->snd_last_ts;
rtp_session_send_rtcp_xr_stat_summary(session);
}
if ((rtcp_st->xr_conf.voip_metrics_enabled == TRUE)
&& ((st->snd_last_ts - rtcp_st->last_rtcp_xr_voip_metrics_s) > rtcp_st->rtcp_xr_voip_metrics_interval)) {
rtcp_st->last_rtcp_xr_voip_metrics_s = st->snd_last_ts;
rtp_session_send_rtcp_xr_voip_metrics(session);
}
}
void rtp_session_rtcp_process_send(RtpSession *session){
RtpStream *st=&session->rtp;
RtcpStream *rtcp_st=&session->rtcp;
......@@ -414,7 +435,9 @@ void rtp_session_rtcp_process_send(RtpSession *session){
notify_sent_rtcp(session,m);
ortp_message("Sending RTCP SR compound message on session [%p].",session);
rtp_session_rtcp_send(session,m);
}
if (session->rtcp.xr_conf.enabled == TRUE) {
rtp_session_rtcp_xr_process_send(session);
}
}
......@@ -564,7 +587,7 @@ void rtp_session_send_rtcp_xr_dlrr(RtpSession *session) {
rtp_session_rtcp_send(session, h);
}
void rtp_session_send_stat_summary(RtpSession *session) {
void rtp_session_send_rtcp_xr_stat_summary(RtpSession *session) {
int size = sizeof(rtcp_xr_header_t) + sizeof(rtcp_xr_stat_summary_report_block_t);
mblk_t *h = allocb(size, 0);
h->b_wptr += rtcp_xr_header_init(h->b_wptr, session, size);
......@@ -572,7 +595,7 @@ void rtp_session_send_stat_summary(RtpSession *session) {
rtp_session_rtcp_send(session, h);
}
void rtp_session_send_voip_metrics(RtpSession *session) {
void rtp_session_send_rtcp_xr_voip_metrics(RtpSession *session) {
int size = sizeof(rtcp_xr_header_t) + sizeof(rtcp_xr_voip_metrics_report_block_t);
mblk_t *h = allocb(size, 0);
h->b_wptr += rtcp_xr_header_init(h->b_wptr, session, size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment