summaryrefslogtreecommitdiff
path: root/pjsip-apps
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-04-07 15:01:51 +0000
committerBenny Prijono <bennylp@teluu.com>2006-04-07 15:01:51 +0000
commit280346e3dfb43813596d4b61a83ca224a3b98ebb (patch)
treed52d17a8bf0dec44e4599127b147ded59c840527 /pjsip-apps
parentbaf5bf601d9dff3e6c7b27cfa5e111531400a20b (diff)
Randomize RTCP send interval to reduce collision risk
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@394 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps')
-rw-r--r--pjsip-apps/src/samples/siprtp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c
index d4d5387e..415a9323 100644
--- a/pjsip-apps/src/samples/siprtp.c
+++ b/pjsip-apps/src/samples/siprtp.c
@@ -990,7 +990,7 @@ static pj_status_t create_sdp( pj_pool_t *pool,
*/
static int media_thread(void *arg)
{
- enum { RTCP_INTERVAL = 5 };
+ enum { RTCP_INTERVAL = 5000, RTCP_RAND = 2000 };
struct media_stream *strm = arg;
char packet[1500];
unsigned msec_interval;
@@ -1003,7 +1003,7 @@ static int media_thread(void *arg)
next_rtp.u64 += (freq.u64 * msec_interval / 1000);
next_rtcp = next_rtp;
- next_rtcp.u64 += (freq.u64 * RTCP_INTERVAL);
+ next_rtcp.u64 += (freq.u64 * (RTCP_INTERVAL+(pj_rand()%RTCP_RAND)) / 1000);
while (!strm->thread_quit_flag) {
@@ -1165,7 +1165,8 @@ static int media_thread(void *arg)
}
/* Schedule next send */
- next_rtcp.u64 += (freq.u64 * RTCP_INTERVAL);
+ next_rtcp.u64 += (freq.u64 * (RTCP_INTERVAL+(pj_rand()%RTCP_RAND)) /
+ 1000);
}
}