[Spice-devel] [PATCH spice-server 06/15] Move dcc_update-streams_max_latency to dcc.c

Jonathon Jongsma jjongsma at redhat.com
Fri Oct 20 21:13:11 UTC 2017


Start moving some stuff out of stream.c since it's currently a mix of
channel and channel client stuff

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 server/dcc.c    | 26 ++++++++++++++++++++++++++
 server/dcc.h    |  1 +
 server/stream.c | 25 -------------------------
 3 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index 0ef2e4fcb..d55f2df3a 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1492,3 +1492,29 @@ gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc)
 {
     return dcc->is_low_bandwidth;
 }
+
+void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent)
+{
+    uint32_t new_max_latency = 0;
+    int i;
+
+    if (dcc_get_max_stream_latency(dcc) != remove_agent->client_required_latency) {
+        return;
+    }
+
+    dcc_set_max_stream_latency(dcc, 0);
+    if (DCC_TO_DC(dcc)->priv->stream_count == 1) {
+        return;
+    }
+    for (i = 0; i < NUM_STREAMS; i++) {
+        StreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
+        if (other_agent == remove_agent || !other_agent->video_encoder) {
+            continue;
+        }
+        if (other_agent->client_required_latency > new_max_latency) {
+            new_max_latency = other_agent->client_required_latency;
+        }
+    }
+    dcc_set_max_stream_latency(dcc, new_max_latency);
+}
+
diff --git a/server/dcc.h b/server/dcc.h
index 284e17036..12603660a 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -202,6 +202,7 @@ uint64_t dcc_get_max_stream_bit_rate(DisplayChannelClient *dcc);
 void dcc_set_max_stream_bit_rate(DisplayChannelClient *dcc, uint64_t rate);
 gboolean dcc_is_low_bandwidth(DisplayChannelClient *dcc);
 GArray *dcc_get_preferred_video_codecs_for_encoding(DisplayChannelClient *dcc);
+void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent);
 
 typedef struct RedStreamClipItem {
     RedPipeItem base;
diff --git a/server/stream.c b/server/stream.c
index 7cbcb827f..933bdf41b 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -528,31 +528,6 @@ void stream_maintenance(DisplayChannel *display,
     }
 }
 
-static void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remove_agent)
-{
-    uint32_t new_max_latency = 0;
-    int i;
-
-    if (dcc_get_max_stream_latency(dcc) != remove_agent->client_required_latency) {
-        return;
-    }
-
-    dcc_set_max_stream_latency(dcc, 0);
-    if (DCC_TO_DC(dcc)->priv->stream_count == 1) {
-        return;
-    }
-    for (i = 0; i < NUM_STREAMS; i++) {
-        StreamAgent *other_agent = dcc_get_stream_agent(dcc, i);
-        if (other_agent == remove_agent || !other_agent->video_encoder) {
-            continue;
-        }
-        if (other_agent->client_required_latency > new_max_latency) {
-            new_max_latency = other_agent->client_required_latency;
-        }
-    }
-    dcc_set_max_stream_latency(dcc, new_max_latency);
-}
-
 static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
 {
     char *env_bit_rate_str;
-- 
2.13.6



More information about the Spice-devel mailing list