From ff31a5270ffbb166d7333d0cc889b48086a64db4 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Thu, 12 Jun 2014 09:25:55 +0200 Subject: [PATCH] Quality reporting: avoid crash in rtcp processing function in case the config proxy is not available --- coreapi/linphonecall.c | 2 +- coreapi/quality_reporting.c | 15 +++++++-------- coreapi/quality_reporting.h | 4 ++-- mediastreamer2 | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b3e4ea740..40c3e197b 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2884,7 +2884,7 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){ LinphoneCallStats *stats=&call->stats[stream_index]; LinphoneCore *lc=call->core; if (stats->updated){ - linphone_reporting_on_rtcp_received(call, stream_index); + linphone_reporting_on_rtcp_update(call, stream_index); if (lc->vtable.call_stats_updated) lc->vtable.call_stats_updated(lc, call, stats); stats->updated = 0; diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index 87bccf961..62a6f071b 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -512,17 +512,18 @@ static float reporting_rand(float t){ return t * (.2f * (rand() / (RAND_MAX * 1.0f)) + 0.9f); } -void linphone_reporting_on_rtcp_received(LinphoneCall *call, int stats_type) { +void linphone_reporting_on_rtcp_update(LinphoneCall *call, int stats_type) { reporting_session_report_t * report = call->log->reporting.reports[stats_type]; reporting_content_metrics_t * metrics = NULL; LinphoneCallStats stats = call->stats[stats_type]; mblk_t *block = NULL; - - int report_interval = linphone_proxy_config_get_quality_reporting_interval(call->dest_proxy); + int report_interval; if (! media_report_enabled(call,stats_type)) return; + report_interval = linphone_proxy_config_get_quality_reporting_interval(call->dest_proxy); + if (stats.updated == LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE) { metrics = &report->remote_metrics; block = stats.received_rtcp; @@ -599,10 +600,10 @@ int linphone_reporting_publish_interval_report(LinphoneCall* call) { void linphone_reporting_call_state_updated(LinphoneCall *call){ LinphoneCallState state=linphone_call_get_state(call); - bool_t enabled=media_report_enabled(call, LINPHONE_CALL_STATS_VIDEO); 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; @@ -621,10 +622,10 @@ void linphone_reporting_call_state_updated(LinphoneCall *call){ } } linphone_reporting_update_ip(call); - if (!enabled && call->log->reporting.was_video_running){ + if (!video_enabled && call->log->reporting.was_video_running){ send_report(call, call->log->reporting.reports[LINPHONE_CALL_STATS_VIDEO], "VQSessionReport"); } - call->log->reporting.was_video_running=enabled; + call->log->reporting.was_video_running=video_enabled; break; } case LinphoneCallEnd:{ @@ -657,11 +658,9 @@ reporting_session_report_t * linphone_reporting_new() { metrics[i]->session_description.packet_loss_concealment = -1; metrics[i]->jitter_buffer.adaptive = -1; - /*metrics[i]->jitter_buffer.rate = -1;*/ metrics[i]->jitter_buffer.abs_max = -1; metrics[i]->delay.end_system_delay = -1; - /*metrics[i]->delay.one_way_delay = -1;*/ metrics[i]->delay.interarrival_jitter = -1; metrics[i]->delay.mean_abs_jitter = -1; diff --git a/coreapi/quality_reporting.h b/coreapi/quality_reporting.h index 6111d4250..34faa4a9c 100644 --- a/coreapi/quality_reporting.h +++ b/coreapi/quality_reporting.h @@ -179,12 +179,12 @@ int linphone_reporting_publish_session_report(LinphoneCall* call, bool_t call_te int linphone_reporting_publish_interval_report(LinphoneCall* call); /** - * Update publish reports with newly received RTCP-XR packets (if available). + * Update publish reports with newly sent/received RTCP-XR packets (if available). * @param call #LinphoneCall object to consider * @param stats_type the media type (LINPHONE_CALL_STATS_AUDIO or LINPHONE_CALL_STATS_VIDEO) * */ -void linphone_reporting_on_rtcp_received(LinphoneCall *call, int stats_type); +void linphone_reporting_on_rtcp_update(LinphoneCall *call, int stats_type); /** * Update publish reports on call state change. diff --git a/mediastreamer2 b/mediastreamer2 index b1baa287e..7a627f30b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b1baa287e0dc18881ebd81fb9938ff89d20fb6a1 +Subproject commit 7a627f30b0462574290e03e99983327e6ea987dc