From 097707624372743f972656b245050cd342fcac8e Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 25 Mar 2015 16:48:53 +0100 Subject: [PATCH] improve reliability of tests measuring bandwidth --- mediastreamer2 | 2 +- tester/call_tester.c | 13 +++++++++---- tester/liblinphone_tester.h | 4 ++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index 160ed0a5c..cd2857a37 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 160ed0a5c49e9067eda87544523a8d1bdb2b5155 +Subproject commit cd2857a373e865135f2bbc49d1108da7c6b17521 diff --git a/tester/call_tester.c b/tester/call_tester.c index c3fd22c00..df6b0b0eb 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -90,6 +90,11 @@ void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCall } else if (lstats->updated == LINPHONE_CALL_STATS_SENT_RTCP_UPDATE) { counters->number_of_rtcp_sent++; } + counters->audio_download_bandwidth = linphone_call_get_audio_stats(call)->download_bandwidth; + counters->audio_upload_bandwidth = linphone_call_get_audio_stats(call)->upload_bandwidth; + counters->video_download_bandwidth = linphone_call_get_video_stats(call)->download_bandwidth; + counters->video_upload_bandwidth = linphone_call_get_video_stats(call)->upload_bandwidth; + } void linphone_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token) { @@ -2856,7 +2861,7 @@ static void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_cb,mgr->lc); linphone_call_send_vfu_request(call); - wait_for_list(lcs,&dummy,1,2000); + wait_for_list(lcs,&dummy,1,2000); /*on some device, it may take 3 to 4s to get audio from mic*/ switch (video_dir) { case LinphoneMediaDirectionInactive: @@ -2879,13 +2884,13 @@ static void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendOnly: CU_ASSERT_TRUE(linphone_call_get_video_stats(call)->download_bandwidth<5); - if (audio_dir == LinphoneMediaDirectionSendOnly) CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth>70); + if (audio_dir == LinphoneMediaDirectionSendOnly) CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); break; case LinphoneMediaDirectionRecvOnly: CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth<5); case LinphoneMediaDirectionSendRecv: - CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->download_bandwidth>70); - if (audio_dir == LinphoneMediaDirectionSendRecv) CU_ASSERT_TRUE(linphone_call_get_audio_stats(call)->upload_bandwidth>70); + CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_download_bandwidth,70,4000)); + if (audio_dir == LinphoneMediaDirectionSendRecv) CU_ASSERT_TRUE(wait_for_list(lcs,&mgr->stat.audio_upload_bandwidth,70,4000)); break; } } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index b77d1debc..6ced687e5 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -212,6 +212,10 @@ typedef struct _stats { int number_of_LinphoneCoreLogCollectionUploadStateDelivered; int number_of_LinphoneCoreLogCollectionUploadStateNotDelivered; int number_of_LinphoneCoreLogCollectionUploadStateInProgress; + int audio_download_bandwidth; + int audio_upload_bandwidth; + int video_download_bandwidth; + int video_upload_bandwidth; }stats;