From 3fb0e1c78352c27b9323192bd89e89d2b2796e45 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 7 Oct 2015 18:37:09 +0200 Subject: [PATCH] fix bandwidth reporting porblem when computer has slept before --- coreapi/linphonecore.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 1e82245f5..9a93058f3 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2532,6 +2532,7 @@ void linphone_core_iterate(LinphoneCore *lc){ uint64_t curtime_ms = ms_get_cur_time_ms(); /*monotonic time*/ int elapsed; time_t current_real_time = ms_time(NULL); + int64_t diff_time; bool_t one_second_elapsed=FALSE; const char *remote_provisioning_uri = NULL; @@ -2561,9 +2562,15 @@ void linphone_core_iterate(LinphoneCore *lc){ if (lc->prevtime_ms == 0){ lc->prevtime_ms = curtime_ms; } - if (curtime_ms-lc->prevtime_ms >= 1000){ - lc->prevtime_ms += 1000; + if ((diff_time=curtime_ms-lc->prevtime_ms) >= 1000){ one_second_elapsed=TRUE; + if (diff_time>3000){ + /*since monotonic time doesn't increment while machine is sleeping, we don't want to catchup too much*/ + lc->prevtime_ms = curtime_ms; + }else{ + lc->prevtime_ms += 1000; + + } } if (lc->ecc!=NULL){