From 18c82bd0cd0f57c01fdbcf578a599e75ee87d903 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 15 Sep 2014 11:41:20 +0200 Subject: [PATCH] Change qos analyzer callback function behaviour --- coreapi/quality_reporting.c | 30 ++++++++++++++++-------------- coreapi/quality_reporting.h | 1 + mediastreamer2 | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index 1977f690b..9e2e6c7ea 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -405,15 +405,9 @@ static void update_ip(LinphoneCall * call, int stats_type) { } } -typedef struct on_action_suggested_struct{ - LinphoneCall *call; - int stats_type; -}on_action_suggested_struct_t; - static void qos_analyzer_on_action_suggested(void *user_data, int datac, const char** datav){ - on_action_suggested_struct_t * oass = (on_action_suggested_struct_t *)user_data; - LinphoneCall *call = oass->call; - reporting_session_report_t *report = call->log->reporting.reports[oass->stats_type]; + reporting_session_report_t *report = (reporting_session_report_t*)user_data; + LinphoneCall *call = report->call; char * appendbuf; int i; int ptime = -1; @@ -653,6 +647,8 @@ int linphone_reporting_publish_interval_report(LinphoneCall* call) { void linphone_reporting_call_state_updated(LinphoneCall *call){ LinphoneCallState state=linphone_call_get_state(call); + MSQosAnalyzer *analyzer; + int i; if (state == LinphoneCallReleased||!quality_reporting_enabled(call)){ return; @@ -660,9 +656,7 @@ void linphone_reporting_call_state_updated(LinphoneCall *call){ switch (state){ case LinphoneCallStreamsRunning:{ bool_t video_enabled=media_report_enabled(call, LINPHONE_CALL_STATS_VIDEO); - int i; MediaStream *streams[2] = {(MediaStream*) call->audiostream, (MediaStream *) call->videostream}; - MSQosAnalyzer *analyzer; for (i=0;i<2;i++){ if (streams[i]==NULL||streams[i]->rc==NULL){ @@ -673,14 +667,12 @@ void linphone_reporting_call_state_updated(LinphoneCall *call){ analyzer=ms_bitrate_controller_get_qos_analyzer(streams[i]->rc); if (analyzer){ - on_action_suggested_struct_t * oass = ms_new0(on_action_suggested_struct_t, 1); - oass->call = call; - oass->stats_type = i; + call->log->reporting.reports[i]->call=call; STR_REASSIGN(call->log->reporting.reports[i]->qos_analyzer.name, ms_strdup(ms_qos_analyzer_get_name(analyzer))); ms_qos_analyzer_set_on_action_suggested(analyzer, qos_analyzer_on_action_suggested, - oass); + call->log->reporting.reports[i]); } } linphone_reporting_update_ip(call); @@ -691,6 +683,16 @@ void linphone_reporting_call_state_updated(LinphoneCall *call){ break; } case LinphoneCallEnd:{ + MediaStream *streams[2] = {(MediaStream*) call->audiostream, (MediaStream *) call->videostream}; + for (i=0;i<2;i++){ + if (streams[i]==NULL||streams[i]->rc==NULL){ + continue; + } + analyzer=ms_bitrate_controller_get_qos_analyzer(streams[i]->rc); + if (analyzer){ + ms_qos_analyzer_set_on_action_suggested(analyzer, NULL, NULL); + } + } if (call->log->status==LinphoneCallSuccess || call->log->status==LinphoneCallAborted){ linphone_reporting_publish_session_report(call, TRUE); } diff --git a/coreapi/quality_reporting.h b/coreapi/quality_reporting.h index 319353fc0..794c78288 100644 --- a/coreapi/quality_reporting.h +++ b/coreapi/quality_reporting.h @@ -137,6 +137,7 @@ typedef struct reporting_session_report { // for internal processing time_t last_report_date; + LinphoneCall *call; } reporting_session_report_t; diff --git a/mediastreamer2 b/mediastreamer2 index 6be5e976f..f5d99970f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6be5e976f12217569da7ad62a44f6ddfe9e9c9d0 +Subproject commit f5d99970fe7467b8780c7b9c8295250e2559591d