use correct cumulative loss value in paused_resumed test

This commit is contained in:
Gautier Pelloux-Prayer 2014-07-04 15:51:28 +02:00
parent a6c1bfd787
commit daddbd60e9
2 changed files with 20 additions and 10 deletions

2
oRTP

@ -1 +1 @@
Subproject commit 8371f181c55db4456fdc61c30c716280736daaf3 Subproject commit 2f82c33a573a4186a3583bdc7de9a6c6f709cc89

View file

@ -926,28 +926,38 @@ static void call_with_custom_headers(void) {
static void call_paused_resumed(void) { static void call_paused_resumed(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
LinphoneCall* call_obj; LinphoneCall* call_pauline;
const rtp_stats_t * stats; const rtp_stats_t * stats;
CU_ASSERT_TRUE(call(pauline,marie)); CU_ASSERT_TRUE(call(pauline,marie));
call_obj = linphone_core_get_current_call(pauline->lc); call_pauline = linphone_core_get_current_call(pauline->lc);
linphone_core_pause_call(pauline->lc,call_obj); wait_for_until(pauline->lc, marie->lc, NULL, 5, 3000);
int exp_cum = - rtp_session_get_rcv_ext_seq_number(call_pauline->audiostream->ms.sessions.rtp_session);
linphone_core_pause_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallPausedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallPaused,1));
exp_cum += rtp_session_get_seq_number(linphone_core_get_current_call(marie->lc)->audiostream->ms.sessions.rtp_session);
/*stay in pause a little while in order to generate traffic*/ /*stay in pause a little while in order to generate traffic*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000);
linphone_core_resume_call(pauline->lc,call_obj); linphone_core_resume_call(pauline->lc,call_pauline);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2)); CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*same here: wait a while for a bit of a traffic*/ /*same here: wait a while for a bit of a traffic, we need to receive a RTCP packet*/
wait_for_until(pauline->lc, marie->lc, NULL, 5, 2000); wait_for_until(pauline->lc, marie->lc, NULL, 5, 5000);
/*there should be no loss on this call, hence cumulative loss should be 0*/ /*there should be a bit of packets loss for the ones sent by PAUSED (pauline) between the latest RTCP SR report received
stats = rtp_session_get_stats(call_obj->sessions->rtp_session); by PAUSER (marie) because PAUSER will drop any packets received after the pause. Keep a tolerance of 1 more packet lost
CU_ASSERT_EQUAL(stats->cum_packet_loss, 0); in case of ...*/
stats = rtp_session_get_stats(call_pauline->sessions->rtp_session);
CU_ASSERT_TRUE(abs(stats->cum_packet_loss - exp_cum)<=1);
/*just to sleep*/ /*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc); linphone_core_terminate_all_calls(pauline->lc);