Blame SOURCES/0020-stream-channel-Activate-streaming-report-from-client.patch

ad1357
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ad1357
From: Frediano Ziglio <fziglio@redhat.com>
ad1357
Date: Wed, 7 Jun 2017 13:13:21 +0100
ad1357
Subject: [spice-server] stream-channel: Activate streaming report from client
ad1357
ad1357
Setting the capability is not enough, each stream must be enabled
ad1357
so do so if client support them.
ad1357
ad1357
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
ad1357
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
ad1357
---
ad1357
 server/stream-channel.c | 19 +++++++++++++++++++
ad1357
 1 file changed, 19 insertions(+)
ad1357
ad1357
diff --git a/server/stream-channel.c b/server/stream-channel.c
ad1357
index ec4bf021d..7e15dd363 100644
ad1357
--- a/server/stream-channel.c
ad1357
+++ b/server/stream-channel.c
ad1357
@@ -27,6 +27,7 @@
ad1357
 #include "reds.h"
ad1357
 #include "common-graphics-channel.h"
ad1357
 #include "display-limits.h"
ad1357
+#include "stream.h" // TODO remove, put common stuff
ad1357
 
ad1357
 #define TYPE_STREAM_CHANNEL_CLIENT stream_channel_client_get_type()
ad1357
 
ad1357
@@ -95,6 +96,7 @@ enum {
ad1357
     RED_PIPE_ITEM_TYPE_STREAM_CREATE,
ad1357
     RED_PIPE_ITEM_TYPE_STREAM_DATA,
ad1357
     RED_PIPE_ITEM_TYPE_STREAM_DESTROY,
ad1357
+    RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT,
ad1357
 };
ad1357
 
ad1357
 typedef struct StreamCreateItem {
ad1357
@@ -230,6 +232,20 @@ stream_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
ad1357
         spice_marshall_msg_display_stream_create(m, &item->stream_create);
ad1357
         break;
ad1357
     }
ad1357
+    case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
ad1357
+        if (client->stream_id < 0
ad1357
+            || !red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_STREAM_REPORT)) {
ad1357
+            return;
ad1357
+        }
ad1357
+        SpiceMsgDisplayStreamActivateReport msg;
ad1357
+        msg.stream_id = client->stream_id;
ad1357
+        msg.unique_id = 1; // TODO useful ?
ad1357
+        msg.max_window_size = RED_STREAM_CLIENT_REPORT_WINDOW;
ad1357
+        msg.timeout_ms = RED_STREAM_CLIENT_REPORT_TIMEOUT;
ad1357
+        red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_ACTIVATE_REPORT);
ad1357
+        spice_marshall_msg_display_stream_activate_report(m, &msg;;
ad1357
+        break;
ad1357
+    }
ad1357
     case RED_PIPE_ITEM_TYPE_STREAM_DATA: {
ad1357
         StreamDataItem *item = SPICE_UPCAST(StreamDataItem, pipe_item);
ad1357
         red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_STREAM_DATA);
ad1357
@@ -459,6 +475,9 @@ stream_channel_change_format(StreamChannel *channel, const StreamMsgFormat *fmt)
ad1357
     item->stream_create.dest = (SpiceRect) { 0, 0, fmt->width, fmt->height };
ad1357
     item->stream_create.clip = (SpiceClip) { SPICE_CLIP_TYPE_NONE, NULL };
ad1357
     red_channel_pipes_add(red_channel, &item->base);
ad1357
+
ad1357
+    // activate stream report if possible
ad1357
+    red_channel_pipes_add_type(red_channel, RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT);
ad1357
 }
ad1357
 
ad1357
 static inline void