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

This commit is contained in:
Gautier Pelloux-Prayer 2016-02-24 15:33:44 +01:00
parent f734477ce4
commit e42a90d2da
2 changed files with 9 additions and 7 deletions

View file

@ -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;
}
}
}

View file

@ -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;