Merge branch 'master' of git.linphone.org:linphone

This commit is contained in:
Ronan Abhamon 2017-02-07 14:06:20 +01:00
commit 3887e0c2d8
3 changed files with 38 additions and 15 deletions

View file

@ -4099,28 +4099,41 @@ static void update_local_stats(LinphoneCallStats *stats, MediaStream *stream) {
stats->clockrate = pt ? pt->clock_rate : 8000;
}
const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call) {
LinphoneCallStats *stats = &call->stats[LINPHONE_CALL_STATS_AUDIO];
if (call->audiostream){
update_local_stats(stats,(MediaStream*)call->audiostream);
static MediaStream *linphone_call_get_stream(LinphoneCall *call, LinphoneStreamType type){
switch(type){
case LinphoneStreamTypeAudio:
return &call->audiostream->ms;
case LinphoneStreamTypeVideo:
return &call->videostream->ms;
case LinphoneStreamTypeText:
return &call->textstream->ms;
case LinphoneStreamTypeUnknown:
break;
}
return stats;
return NULL;
}
const LinphoneCallStats *linphone_call_get_stats(LinphoneCall *call, LinphoneStreamType type){
if (type>=0 && type<=LinphoneStreamTypeText){
LinphoneCallStats *stats = &call->stats[type];
MediaStream *ms = linphone_call_get_stream(call, type);
if (ms) update_local_stats(stats, ms);
return stats;
}
ms_error("Invalid stream type %i", (int)type);
return NULL;
}
const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call) {
return linphone_call_get_stats(call, LinphoneStreamTypeAudio);
}
const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call) {
LinphoneCallStats *stats = &call->stats[LINPHONE_CALL_STATS_VIDEO];
if (call->videostream){
update_local_stats(stats,(MediaStream*)call->videostream);
}
return stats;
return linphone_call_get_stats(call, LinphoneStreamTypeVideo);
}
const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call) {
LinphoneCallStats *stats = &call->stats[LINPHONE_CALL_STATS_TEXT];
if (call->textstream){
update_local_stats(stats,(MediaStream*)call->textstream);
}
return stats;
return linphone_call_get_stats(call, LinphoneStreamTypeText);
}
static bool_t ice_in_progress(LinphoneCallStats *stats){

View file

@ -571,6 +571,8 @@ LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
*/
LINPHONE_PUBLIC void linphone_call_ogl_render(LinphoneCall *call, bool_t is_preview);
/**
* @}
*/

View file

@ -546,6 +546,14 @@ typedef enum _LinphoneAddressFamily LinphoneAddressFamily;
#include "linphone/call_stats.h"
/**
* Return call statistics for a particular stream type.
* @param call the call
* @param type the stream type
**/
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_stats(LinphoneCall *call, LinphoneStreamType type);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);