[Spice-commits] src/channel-display.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 15 17:11:12 UTC 2019


 src/channel-display.c |   89 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 58 insertions(+), 31 deletions(-)

New commits:
commit 8fcba6d59c560bf4d097f2a2dd32fe588cbf17f5
Author: Victor Toso <me at victortoso.com>
Date:   Tue Mar 13 11:01:18 2018 +0100

    channel-display: add display_stream_stats_debug() helper
    
    To factor out code from display_stream_destroy() that are specific to
    statistics in display_stream and not handling stream's destruction.
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/channel-display.c b/src/channel-display.c
index c52c8cd..ae949eb 100644
--- a/src/channel-display.c
+++ b/src/channel-display.c
@@ -1545,6 +1545,63 @@ static void display_session_mm_time_reset_cb(SpiceSession *session, gpointer dat
 
 #define STREAM_PLAYBACK_SYNC_DROP_SEQ_LEN_LIMIT 5
 
+static void display_stream_stats_debug(display_stream *st)
+{
+    guint64 drops_duration_total = 0;
+    guint32 i, num_out_frames;
+    gdouble avg_late_time = 0.0;
+
+    if (st->num_input_frames == 0) {
+        return;
+    }
+
+    num_out_frames = st->num_input_frames - st->arrive_late_count - st->num_drops_on_playback;
+
+    if (st->arrive_late_count != 0) {
+        avg_late_time = st->arrive_late_time / ((double)st->arrive_late_count);
+    }
+
+    CHANNEL_DEBUG(st->channel,
+        "%s: id=%u #in-frames=%u out/in=%.2f "
+        "#drops-on-receive=%u avg-late-time(ms)=%.2f "
+        "#drops-on-playback=%u",
+        __FUNCTION__,
+        st->id,
+        st->num_input_frames,
+        num_out_frames / (double)st->num_input_frames,
+        st->arrive_late_count,
+        avg_late_time,
+        st->num_drops_on_playback);
+
+    if (st->num_drops_seqs) {
+        CHANNEL_DEBUG(st->channel,
+                      "%s: #drops-sequences=%u ==>",
+                      __FUNCTION__,
+                      st->num_drops_seqs);
+    }
+
+    for (i = 0; i < st->num_drops_seqs; i++) {
+        drops_sequence_stats *stats = &g_array_index(st->drops_seqs_stats_arr,
+                                                     drops_sequence_stats,
+                                                     i);
+        drops_duration_total += stats->duration;
+        CHANNEL_DEBUG(st->channel,
+                      "%s: \t len=%u start-ms=%u duration-ms=%u",
+                      __FUNCTION__,
+                      stats->len,
+                      stats->start_mm_time - st->first_frame_mm_time,
+                      stats->duration);
+    }
+
+    if (st->num_drops_seqs) {
+        CHANNEL_DEBUG(st->channel,
+                      "%s: drops-total-duration=%"G_GUINT64_FORMAT" ==>",
+                      __FUNCTION__,
+                      drops_duration_total);
+    }
+}
+
+
 static void display_stream_stats_save(display_stream *st,
                                       guint32 server_mmtime,
                                       guint32 client_mmtime)
@@ -1673,39 +1730,9 @@ static void display_handle_stream_clip(SpiceChannel *channel, SpiceMsgIn *in)
 
 static void display_stream_destroy(gpointer st_pointer)
 {
-    int i;
     display_stream *st = st_pointer;
 
-    if (st->num_input_frames > 0) {
-        guint64 drops_duration_total = 0;
-        guint32 num_out_frames = st->num_input_frames - st->arrive_late_count - st->num_drops_on_playback;
-        CHANNEL_DEBUG(st->channel, "%s: id=%u #in-frames=%u out/in=%.2f "
-            "#drops-on-receive=%u avg-late-time(ms)=%.2f "
-            "#drops-on-playback=%u", __FUNCTION__,
-            st->id,
-            st->num_input_frames,
-            num_out_frames / (double)st->num_input_frames,
-            st->arrive_late_count,
-            st->arrive_late_count ? st->arrive_late_time / ((double)st->arrive_late_count): 0,
-            st->num_drops_on_playback);
-        if (st->num_drops_seqs) {
-            CHANNEL_DEBUG(st->channel, "%s: #drops-sequences=%u ==>", __FUNCTION__, st->num_drops_seqs);
-        }
-        for (i = 0; i < st->num_drops_seqs; i++) {
-            drops_sequence_stats *stats = &g_array_index(st->drops_seqs_stats_arr,
-                                                         drops_sequence_stats,
-                                                         i);
-            drops_duration_total += stats->duration;
-            CHANNEL_DEBUG(st->channel, "%s: \t len=%u start-ms=%u duration-ms=%u", __FUNCTION__,
-                          stats->len,
-                          stats->start_mm_time - st->first_frame_mm_time,
-                          stats->duration);
-        }
-        if (st->num_drops_seqs) {
-            CHANNEL_DEBUG(st->channel, "%s: drops-total-duration=%"G_GUINT64_FORMAT" ==>", __FUNCTION__, drops_duration_total);
-        }
-    }
-
+    display_stream_stats_debug(st);
     g_array_free(st->drops_seqs_stats_arr, TRUE);
 
     if (st->video_decoder) {


More information about the Spice-commits mailing list