From e42a90d2da9fa0b81c6b8f62ef3a93d2082d7e57 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 24 Feb 2016 15:33:44 +0100 Subject: [PATCH] tester: fix bandwidth computation to only update current stream estimation, not all of them at once --- tester/call_tester.c | 14 ++++++++------ tester/liblinphone_tester.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tester/call_tester.c b/tester/call_tester.c index 5d7af52b2..77c787f02 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -95,12 +95,14 @@ void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCall } if (lstats->updated & LINPHONE_CALL_STATS_PERIODICAL_UPDATE ) { int tab_size = sizeof (counters->audio_download_bandwidth)/sizeof(int); - int index = (counters->current_bandwidth_index++) % tab_size; - - counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; - counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; - counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; - counters->video_upload_bandwidth[index] = (int)linphone_call_get_video_stats(call)->upload_bandwidth; + int index = (counters->current_bandwidth_index[lstats->type]++) % tab_size; + if (lstats->type == LINPHONE_CALL_STATS_AUDIO) { + counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; + counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; + } else { + counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; + counters->video_upload_bandwidth[index] = (int)linphone_call_get_video_stats(call)->upload_bandwidth; + } } } diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index 9c9898983..f0938839a 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -238,7 +238,7 @@ typedef struct _stats { int video_download_bandwidth[3]; int video_upload_bandwidth[3]; - int current_bandwidth_index; + int current_bandwidth_index[2] /*audio and video only*/; int number_of_rtcp_generic_nack; }stats;