[ekiga] Fix jitter statistics when unavailable



commit 8562deebf57b25b041de63ff3fd6ff74ccb22b4b
Author: Eugen Dedu <eugen dedu univ-fcomte fr>
Date:   Mon Dec 7 13:36:07 2015 +0100

    Fix jitter statistics when unavailable
    
    When jitter information is unavailable, opal returned -1, but jitter
    variables in Ekiga were declared as unsigned, hence they were interpreted
    as very big values, hence an error message was shown about bad Internet
    connection.

 lib/engine/gui/gtk-frontend/call-window.cpp |   25 +++++++++++++++++++------
 lib/engine/protocol/rtcp-statistics.h       |    8 ++++----
 2 files changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/call-window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
index d96d664..c6c8381 100644
--- a/lib/engine/gui/gtk-frontend/call-window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -1131,22 +1131,35 @@ ekiga_call_window_update_stats (EkigaCallWindow *self,
   else
     tr_video_msg = g_strdup ("");
 
+  gchar *jitter, *remote_jitter;
+  if (stats.jitter == -1)
+    jitter = g_strdup (_("N/A"));
+  else
+    jitter = g_strdup_printf (_("%d ms"), stats.jitter);
+  if (stats.remote_jitter == -1)
+    remote_jitter = g_strdup (_("N/A"));
+  else
+    remote_jitter = g_strdup_printf (_("%d ms"), stats.remote_jitter);
+
   stats_msg =
-    g_strdup_printf (_("<b><u>Reception:</u></b> %s %s\nLost Packets: %d %%\nJitter: %d ms\nFramerate: %d 
fps\nBandwidth: %d kbits/s\n\n"
-                       "<b><u>Transmission:</u></b> %s %s\nRemote Lost Packets: %d %%\nRemote Jitter: %d 
ms\nFramerate: %d fps\nBandwidth: %d kbits/s\n\n"),
-                       stats.received_audio_codec.c_str (), re_video_msg, stats.lost_packets, stats.jitter,
-                       stats.received_fps, stats.received_audio_bandwidth + stats.received_video_bandwidth,
-                       stats.transmitted_audio_codec.c_str (), tr_video_msg, stats.remote_lost_packets, 
stats.remote_jitter,
-                       stats.transmitted_fps, stats.transmitted_audio_bandwidth + 
stats.transmitted_video_bandwidth);
+    g_strdup_printf (_("<b><u>Reception:</u></b> %s %s\nLost Packets: %d %%\nJitter: %s\nFramerate: %d 
fps\nBandwidth: %d kbits/s\n\n"
+                       "<b><u>Transmission:</u></b> %s %s\nRemote Lost Packets: %d %%\nRemote Jitter: 
%s\nFramerate: %d fps\nBandwidth: %d kbits/s\n\n"),
+                     stats.received_audio_codec.c_str (), re_video_msg, stats.lost_packets, jitter,
+                     stats.received_fps, stats.received_audio_bandwidth + stats.received_video_bandwidth,
+                     stats.transmitted_audio_codec.c_str (), tr_video_msg, stats.remote_lost_packets, 
remote_jitter,
+                     stats.transmitted_fps, stats.transmitted_audio_bandwidth + 
stats.transmitted_video_bandwidth);
   gtk_widget_set_tooltip_markup (GTK_WIDGET (self->priv->event_box), stats_msg);
 
   if (!self->priv->bad_connection && (stats.jitter > 250 || stats.lost_packets > 2)) {
+
     gm_info_bar_push_message (GM_INFO_BAR (self->priv->info_bar),
                               GTK_MESSAGE_WARNING,
                               _("The call quality is rather bad. Please check your Internet connection or 
your audio driver."));
     self->priv->bad_connection = true;
   }
 
+  g_free (jitter);
+  g_free (remote_jitter);
   g_free (stats_msg);
   g_free (re_video_msg);
   g_free (tr_video_msg);
diff --git a/lib/engine/protocol/rtcp-statistics.h b/lib/engine/protocol/rtcp-statistics.h
index 7211ac2..1f7d0c8 100644
--- a/lib/engine/protocol/rtcp-statistics.h
+++ b/lib/engine/protocol/rtcp-statistics.h
@@ -43,8 +43,8 @@ public:
     RTCPStatistics () :
         transmitted_audio_bandwidth (0),
         received_audio_bandwidth (0),
-        jitter (0),
-        remote_jitter (0),
+        jitter (-1),
+        remote_jitter (-1),
         transmitted_video_bandwidth (0),
         received_video_bandwidth (0),
         received_fps (0),
@@ -57,8 +57,8 @@ public:
     unsigned transmitted_audio_bandwidth; // in kbits/s
     std::string received_audio_codec;
     unsigned received_audio_bandwidth; // in kbits/s
-    unsigned jitter; // in ms
-    unsigned remote_jitter; // in ms
+    int jitter; // in ms (-1 is N/A, as given by opal)
+    int remote_jitter; // in ms (-1 is N/A, as given by opal)
 
     /* Video */
     std::string transmitted_video_codec;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]