00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00027 #include "rtcp.h"
00028
00029 #define RTCP_MIN_TIME 5.0
00030 #define RTCP_SENDER_BW_FRACTION 0.25
00031 #define RTCP_RCVR_BW_FRACTION 0.75
00032 #define COMPENSATION 1.21828
00033
00044 double rtcp_interval(int members, int senders, double rtcp_bw, int we_sent,
00045 double avg_rtcp_size, int initial)
00046 {
00047 double t;
00048 double rtcp_min_time = RTCP_MIN_TIME;
00049 int n;
00050
00051 if (initial)
00052 rtcp_min_time /= 2;
00053
00054 n = members;
00055 if (senders > 0 && senders < members * RTCP_SENDER_BW_FRACTION) {
00056 if (we_sent) {
00057 rtcp_bw *= RTCP_SENDER_BW_FRACTION;
00058 n = senders;
00059 } else {
00060 rtcp_bw *= RTCP_RCVR_BW_FRACTION;
00061 n -= senders;
00062 }
00063 }
00064 if ((t = avg_rtcp_size * n / rtcp_bw) < rtcp_min_time)
00065 t = rtcp_min_time;
00066 t = (t * (drand48() + 0.5)) / COMPENSATION;
00067 return t;
00068 }