From 0de510100c6d26a5602c4059cac07f2d9684ef59 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 9 Jan 2018 16:30:48 +0100 Subject: [PATCH] Fixed previous cherry-pick --- include/linphone/api/c-call-stats.h | 2 ++ src/c-wrapper/api/c-call-stats.cpp | 4 ++++ src/conference/session/media-session.cpp | 4 ++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linphone/api/c-call-stats.h b/include/linphone/api/c-call-stats.h index 9192fdd4c..ca39bb0d9 100644 --- a/include/linphone/api/c-call-stats.h +++ b/include/linphone/api/c-call-stats.h @@ -198,6 +198,8 @@ LINPHONE_PUBLIC float linphone_call_stats_get_round_trip_delay (const LinphoneCa */ LINPHONE_PUBLIC float linphone_call_stats_get_estimated_download_bandwidth(const LinphoneCallStats *stats); +void linphone_call_stats_set_estimated_download_bandwidth(LinphoneCallStats *stats, float estimated_value); + /** * @} */ diff --git a/src/c-wrapper/api/c-call-stats.cpp b/src/c-wrapper/api/c-call-stats.cpp index c8fa47375..b95244b86 100644 --- a/src/c-wrapper/api/c-call-stats.cpp +++ b/src/c-wrapper/api/c-call-stats.cpp @@ -359,3 +359,7 @@ float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats) float linphone_call_stats_get_estimated_download_bandwidth(const LinphoneCallStats *stats) { return stats->estimated_download_bandwidth; } + +void linphone_call_stats_set_estimated_download_bandwidth(LinphoneCallStats *stats, float estimated_value) { + stats->estimated_download_bandwidth = estimated_value; +} diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 1446f0404..b16997868 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -2298,8 +2298,8 @@ void MediaSessionPrivate::handleStreamEvents (int streamIndex) { } else if (evt == ORTP_EVENT_NEW_VIDEO_BANDWIDTH_ESTIMATION_AVAILABLE) { lInfo() << "Video bandwidth estimation is " << (int)(evd->info.video_bandwidth_available / 1000.) << " kbit/s"; /* If this event happens then it should be a video stream */ - if (stream_index == call->main_video_stream_index) - stats->estimated_download_bandwidth = (float)(evd->info.video_bandwidth_available)*1e-3; + if (streamIndex == mainVideoStreamIndex) + linphone_call_stats_set_estimated_download_bandwidth(stats, (float)(evd->info.video_bandwidth_available*1e-3)); } ortp_event_destroy(ev); }