[Spice-devel] [RFC spice-server 2/2] streaming: Restart guest video streams on video-codec changes
Kevin Pouget
kpouget at redhat.com
Fri Aug 2 13:10:43 UTC 2019
This patch resets the host and guest video streams when the client
changes the preferred video-codecs or when the host admin updates the
list of video-codecs allowed.
Signed-off-by: Kevin Pouget <kpouget at redhat.com>
---
server/dcc.c | 4 +++-
server/display-channel.c | 2 +-
server/video-stream.c | 11 +++++++++++
server/video-stream.h | 1 +
4 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/server/dcc.c b/server/dcc.c
index 21e8598e..1631a2b4 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1193,7 +1193,9 @@ static int dcc_handle_preferred_video_codec_type(DisplayChannelClient *dcc,
/* New client preference */
dcc_update_preferred_video_codecs(dcc);
- video_stream_detach_and_stop(DCC_TO_DC(dcc));
+
+ /* Reset video streams */
+ video_stream_codecs_changed(DCC_TO_DC(dcc));
return TRUE;
}
diff --git a/server/display-channel.c b/server/display-channel.c
index 75266598..65bc15ca 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -256,7 +256,7 @@ void display_channel_set_video_codecs(DisplayChannel *display, GArray *video_cod
display->priv->video_codecs = g_array_ref(video_codecs);
g_object_notify(G_OBJECT(display), "video-codecs");
- video_stream_detach_and_stop(display);
+ video_stream_codecs_changed(display);
}
GArray *display_channel_get_video_codecs(DisplayChannel *display)
diff --git a/server/video-stream.c b/server/video-stream.c
index 6aa859a0..d0f0a401 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -20,6 +20,7 @@
#include "display-channel-private.h"
#include "main-channel-client.h"
#include "red-client.h"
+#include "stream-channel.h"
#define FPS_TEST_INTERVAL 1
#define FOREACH_STREAMS(display, item) \
@@ -950,6 +951,16 @@ void video_stream_timeout(DisplayChannel *display)
}
}
+void video_stream_codecs_changed(DisplayChannel *display)
+{
+ /* Reset guest video streams */
+ if (IS_STREAM_CHANNEL(display)) {
+ stream_channel_reset(STREAM_CHANNEL(display));
+ }
+ /* Reset host video streams */
+ video_stream_detach_and_stop(display);
+}
+
void video_stream_trace_add_drawable(DisplayChannel *display,
Drawable *item)
{
diff --git a/server/video-stream.h b/server/video-stream.h
index 46b076fd..fe74fc34 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -147,6 +147,7 @@ void video_stream_detach_and_stop(DisplayChannel *display);
void video_stream_trace_add_drawable(DisplayChannel *display, Drawable *item);
void video_stream_detach_behind(DisplayChannel *display, QRegion *region,
Drawable *drawable);
+void video_stream_codecs_changed(DisplayChannel *display);
void video_stream_agent_unref(DisplayChannel *display, VideoStreamAgent *agent);
void video_stream_agent_stop(VideoStreamAgent *agent);
--
2.21.0
More information about the Spice-devel
mailing list