[Spice-devel] [PATCH spice-server 3/6] Simplify sending stream report activation message

Frediano Ziglio fziglio at redhat.com
Fri Dec 8 15:55:21 UTC 2017


Store information directly in the RedStreamActivateReportItem
making easier to marshall the message.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/dcc-send.c     | 10 ++++------
 server/video-stream.c |  1 +
 server/video-stream.h |  1 +
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/dcc-send.c b/server/dcc-send.c
index 828a472f..364f3405 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -2308,15 +2308,13 @@ static void marshall_monitors_config(RedChannelClient *rcc, SpiceMarshaller *bas
 
 static void marshall_stream_activate_report(RedChannelClient *rcc,
                                             SpiceMarshaller *base_marshaller,
-                                            uint32_t stream_id)
+                                            RedStreamActivateReportItem *report_item)
 {
-    DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
-    VideoStreamAgent *agent = &dcc->priv->stream_agents[stream_id];
     SpiceMsgDisplayStreamActivateReport msg;
 
     red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT);
-    msg.stream_id = stream_id;
-    msg.unique_id = agent->report_id;
+    msg.stream_id = report_item->stream_id;
+    msg.unique_id = report_item->report_id;
     msg.max_window_size = RED_STREAM_CLIENT_REPORT_WINDOW;
     msg.timeout_ms = RED_STREAM_CLIENT_REPORT_TIMEOUT;
     spice_marshall_msg_display_stream_activate_report(base_marshaller, &msg);
@@ -2454,7 +2452,7 @@ void dcc_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
         RedStreamActivateReportItem *report_item = SPICE_CONTAINEROF(pipe_item,
                                                                      RedStreamActivateReportItem,
                                                                      pipe_item);
-        marshall_stream_activate_report(rcc, m, report_item->stream_id);
+        marshall_stream_activate_report(rcc, m, report_item);
         break;
     }
     case RED_PIPE_ITEM_TYPE_GL_SCANOUT:
diff --git a/server/video-stream.c b/server/video-stream.c
index 89f94ffb..b236774a 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -759,6 +759,7 @@ void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
         red_pipe_item_init(&report_pipe_item->pipe_item,
                            RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
         report_pipe_item->stream_id = stream_id;
+        report_pipe_item->report_id = agent->report_id;
         red_channel_client_pipe_add(RED_CHANNEL_CLIENT(dcc), &report_pipe_item->pipe_item);
     }
 #ifdef STREAM_STATS
diff --git a/server/video-stream.h b/server/video-stream.h
index a4d14981..2dfcf7bf 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -48,6 +48,7 @@ typedef struct VideoStream VideoStream;
 typedef struct RedStreamActivateReportItem {
     RedPipeItem pipe_item;
     uint32_t stream_id;
+    uint32_t report_id;
 } RedStreamActivateReportItem;
 
 #ifdef STREAM_STATS
-- 
2.14.3



More information about the Spice-devel mailing list