[Spice-devel] [PATCH spice-server 07/15] Move StreamCreateDestroyItem to dcc

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


Start moving some channel client stuff out of stream.[ch]

Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
 server/dcc.c    | 28 ++++++++++++++++++++++++++++
 server/dcc.h    |  7 +++++++
 server/stream.c | 29 -----------------------------
 server/stream.h |  5 -----
 4 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index d55f2df3a..6e64f44d3 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1518,3 +1518,31 @@ void dcc_update_streams_max_latency(DisplayChannelClient *dcc, StreamAgent *remo
     dcc_set_max_stream_latency(dcc, new_max_latency);
 }
 
+static void stream_create_destroy_item_release(RedPipeItem *base)
+{
+    StreamCreateDestroyItem *item = SPICE_UPCAST(StreamCreateDestroyItem, base);
+    stream_agent_unref(item->agent);
+    g_free(item);
+}
+
+static RedPipeItem *stream_create_destroy_item_new(StreamAgent *agent, gint type)
+{
+    StreamCreateDestroyItem *item = g_new0(StreamCreateDestroyItem, 1);
+
+    red_pipe_item_init_full(&item->base, type,
+                            stream_create_destroy_item_release);
+    agent->stream->refs++;
+    item->agent = agent;
+    return &item->base;
+}
+
+RedPipeItem *stream_create_item_new(StreamAgent *agent)
+{
+    return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
+}
+
+RedPipeItem *stream_destroy_item_new(StreamAgent *agent)
+{
+    return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
+}
+
diff --git a/server/dcc.h b/server/dcc.h
index 12603660a..0119c57df 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -211,6 +211,13 @@ typedef struct RedStreamClipItem {
     SpiceClipRects *rects;
 } RedStreamClipItem;
 
+typedef struct StreamCreateDestroyItem {
+    RedPipeItem base;
+    StreamAgent *agent;
+} StreamCreateDestroyItem;
+
+RedPipeItem *stream_create_item_new(StreamAgent *agent);
+RedPipeItem *stream_destroy_item_new(StreamAgent *agent);
 G_END_DECLS
 
 #endif /* DCC_H_ */
diff --git a/server/stream.c b/server/stream.c
index 933bdf41b..6b585f653 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -63,35 +63,6 @@ static void stream_agent_stats_print(StreamAgent *agent)
 #endif
 }
 
-static void stream_create_destroy_item_release(RedPipeItem *base)
-{
-    StreamCreateDestroyItem *item = SPICE_UPCAST(StreamCreateDestroyItem, base);
-    stream_agent_unref(item->agent);
-    g_free(item);
-}
-
-static RedPipeItem *stream_create_destroy_item_new(StreamAgent *agent, gint type)
-{
-    StreamCreateDestroyItem *item = g_new0(StreamCreateDestroyItem, 1);
-
-    red_pipe_item_init_full(&item->base, type,
-                            stream_create_destroy_item_release);
-    agent->stream->refs++;
-    item->agent = agent;
-    return &item->base;
-}
-
-static RedPipeItem *stream_create_item_new(StreamAgent *agent)
-{
-    return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_CREATE);
-}
-
-static RedPipeItem *stream_destroy_item_new(StreamAgent *agent)
-{
-    return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
-}
-
-
 void stream_stop(DisplayChannel *display, Stream *stream)
 {
     DisplayChannelClient *dcc;
diff --git a/server/stream.h b/server/stream.h
index 607f18106..b721593d5 100644
--- a/server/stream.h
+++ b/server/stream.h
@@ -86,11 +86,6 @@ typedef struct StreamAgent {
 #endif
 } StreamAgent;
 
-typedef struct StreamCreateDestroyItem {
-    RedPipeItem base;
-    StreamAgent *agent;
-} StreamCreateDestroyItem;
-
 typedef struct ItemTrace {
     red_time_t time;
     red_time_t first_frame_time;
-- 
2.13.6



More information about the Spice-devel mailing list