[Spice-devel] [PATCH v6 26/26] spice-gtk: Use decodebin as a fallback for the GStreamer video decoder

Francois Gouget fgouget at codeweavers.com
Wed Oct 14 08:34:45 PDT 2015


This means future video codecs may be supported automatically.
One can also force usage of decodebin by setting $SPICE_GSTVIDEO_AUTO.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 src/channel-display-gst.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)


Changes since the previous version:
 * The previous iteration would sometimes add both typefind and 
   decodebin to the pipeline which is redudant since the bin built by 
   decodebin includes typefind.
 * Also using typefind separately from decodebin does not seem very 
   useful so I removed that mode.


diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
index dbde4fa..073d4c3 100644
--- a/src/channel-display-gst.c
+++ b/src/channel-display-gst.c
@@ -108,7 +108,16 @@ static gboolean construct_pipeline(SpiceGstDecoder *decoder)
     decoder->pipeline_wait = TRUE;
     decoder->samples_count = 0;
 
-    const gchar *src_caps, *gstdec_name;
+    /* Note that we cannot rely on typefind to always identify the stream type
+     * (e.g. VP8). So always set the source caps for streams we know about.
+     * See: https://bugzilla.gnome.org/show_bug.cgi?id=756457
+     *
+     * Furthermore decodebin will use vaapi if installed, which for a time
+     * could intentionally crash the application. So only use decodebin as a
+     * fallback for now. See: https://bugs.freedesktop.org/show_bug.cgi?id=90884
+     */
+    const gchar *src_caps;
+    const gchar *gstdec_name = NULL;
     switch (decoder->base.codec_type) {
     case SPICE_VIDEO_CODEC_TYPE_MJPEG:
         src_caps = "caps=image/jpeg";
@@ -123,8 +132,14 @@ static gboolean construct_pipeline(SpiceGstDecoder *decoder)
         gstdec_name = "h264parse ! avdec_h264";
         break;
     default:
-        spice_warning("Unknown codec type %d", decoder->base.codec_type);
-        return -1;
+        SPICE_DEBUG("Unknown codec type %d. Trying decodebin.",
+                    decoder->base.codec_type);
+        src_caps = "";
+        break;
+    }
+    /* Set SPICE_GSTVIDEO_AUTO to test decodebin and maybe get hardware acceleration */
+    if (!gstdec_name || getenv("SPICE_GSTVIDEO_AUTO")) {
+        gstdec_name = "decodebin";
     }
 
     GError *err = NULL;
-- 
2.6.1


More information about the Spice-devel mailing list