Commit e42a90d2 authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

tester: fix bandwidth computation to only update current stream estimation, not all of them at once

parent f734477c
......@@ -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;
}
}
}
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment