[PATCH v1 1/5] dcc: Check to see if the client supports multiple codecs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to determine if the client is new enough to support multiple
codecs -- which might include any of the Gstreamer based ones.

Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Cc: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
Cc: Dongwon Kim <dongwon.kim@xxxxxxxxx>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@xxxxxxxxx>
---
 server/dcc-private.h             |  2 ++
 server/dcc.cpp                   | 22 +++++++++++-----------
 server/display-channel-private.h |  6 ++++++
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/server/dcc-private.h b/server/dcc-private.h
index 842c14b2..bf485aec 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -27,6 +27,8 @@
 
 #include "push-visibility.h"
 
+XXX_CAST(RedChannelClient, DisplayChannelClient, DISPLAY_CHANNEL_CLIENT);
+
 struct DisplayChannelClientPrivate
 {
     SPICE_CXX_GLIB_ALLOCATOR
diff --git a/server/dcc.cpp b/server/dcc.cpp
index 01c16ab7..f0b355ca 100644
--- a/server/dcc.cpp
+++ b/server/dcc.cpp
@@ -494,29 +494,29 @@ RedSurfaceDestroyItem::RedSurfaceDestroyItem(uint32_t surface_id)
 
 RedPipeItemPtr dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
 {
-    /* FIXME: on !unix peer, start streaming with a video codec */
-    if (!red_stream_is_plain_unix(rcc->get_stream()) ||
-        !rcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT)) {
+    DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
+
+    if (dcc_is_gl_client(dcc)) {
+        return red::make_shared<RedGlScanoutUnixItem>();
+    } else if (rcc->test_remote_cap(SPICE_DISPLAY_CAP_MULTI_CODEC)) {
+        return RedPipeItemPtr();
+    } else {
         red_channel_warning(rcc->get_channel(),
-                            "FIXME: client does not support GL scanout");
+                            "Client does not support GL scanout or multiple codecs");
         rcc->disconnect();
         return RedPipeItemPtr();
     }
-
-    return red::make_shared<RedGlScanoutUnixItem>();
 }
 
-XXX_CAST(RedChannelClient, DisplayChannelClient, DISPLAY_CHANNEL_CLIENT);
-
 RedPipeItemPtr dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     auto draw = static_cast<const SpiceMsgDisplayGlDraw *>(data);
 
-    if (!red_stream_is_plain_unix(rcc->get_stream()) ||
-        !rcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT)) {
+    if (!dcc_is_gl_client(dcc) &&
+        !rcc->test_remote_cap(SPICE_DISPLAY_CAP_MULTI_CODEC)) {
         red_channel_warning(rcc->get_channel(),
-                            "FIXME: client does not support GL scanout");
+                            "Client does not support GL scanout or multiple codecs");
         rcc->disconnect();
         return RedPipeItemPtr();
     }
diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index 04ac2c0d..7600f213 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -346,4 +346,10 @@ static inline void region_add_clip_rects(QRegion *rgn, SpiceClipRects *data)
     }
 }
 
+static inline bool dcc_is_gl_client(DisplayChannelClient *dcc)
+{
+    return red_stream_is_plain_unix(dcc->get_stream()) &&
+           dcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT);
+}
+
 #endif /* DISPLAY_CHANNEL_PRIVATE_H_ */
-- 
2.37.2




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]