[Spice-devel] [RFC PATCH spice-server v4 18/22] stream-channel: Activate streaming report from client

Frediano Ziglio fziglio at redhat.com
Fri Aug 25 09:54:05 UTC 2017


Setting the capability is not enough, each stream must be enabled
so do so if client support them.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/stream-channel.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/server/stream-channel.c b/server/stream-channel.c
index 34c8a351..a0915e59 100644
--- a/server/stream-channel.c
+++ b/server/stream-channel.c
@@ -27,6 +27,7 @@
 #include "reds.h"
 #include "common-graphics-channel.h"
 #include "display-limits.h"
+#include "stream.h" // TODO remove, put common stuff
 
 #define TYPE_STREAM_CHANNEL_CLIENT stream_channel_client_get_type()
 
@@ -93,6 +94,7 @@ enum {
     RED_PIPE_ITEM_TYPE_STREAM_CREATE,
     RED_PIPE_ITEM_TYPE_STREAM_DATA,
     RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
+    RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
 };
 
 typedef struct StreamCreateItem {
@@ -223,6 +225,20 @@ stream_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
         spice_marshall_msg_display_stream_create(m, &item->stream_create);
         break;
     }
+    case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
+        if (client->stream_id < 0
+            || !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_STREAM_REPORT)) {
+            return;
+        }
+        SpiceMsgDisplayStreamActivateReport msg;
+        msg.stream_id = client->stream_id;
+        msg.unique_id = 1; // TODO useful ?
+        msg.max_window_size = RED_STREAM_CLIENT_REPORT_WINDOW;
+        msg.timeout_ms = RED_STREAM_CLIENT_REPORT_TIMEOUT;
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT);
+        spice_marshall_msg_display_stream_activate_report(m, &msg);
+        break;
+    }
     case RED_PIPE_ITEM_TYPE_STREAM_DATA: {
         StreamDataItem *item = SPICE_UPCAST(StreamDataItem, pipe_item);
         red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA);
@@ -458,6 +474,9 @@ stream_channel_change_format(StreamChannel *channel, const StreamMsgFormat *fmt)
     item->stream_create.clip = (SpiceClip) { SPICE_CLIP_TYPE_NONE, NULL };
     red_channel_pipes_new_add(red_channel, pipe_item_new_ref, item);
     red_pipe_item_unref(&item->base);
+
+    // activate stream report if possible
+    red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
 }
 
 static inline void
-- 
2.13.5



More information about the Spice-devel mailing list