[shotwell] Blacklist vaapi decoder



commit 1f07d737505a2c4ecc7c2ed0e415a9f8b9f4bd26
Author: Jens Georg <mail jensge org>
Date:   Tue Oct 18 22:28:33 2016 +0200

    Blacklist vaapi decoder
    
    That makes things actually slow since it start-up isn't the best in the world
    and doesn't like to be triggered from multiple threads, causing the abort.
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762416

 src/VideoSupport.vala                       |   30 +++++++++++++++++++++-----
 thumbnailer/shotwell-video-thumbnailer.vala |   16 +++++++++++++-
 2 files changed, 39 insertions(+), 7 deletions(-)
---
diff --git a/src/VideoSupport.vala b/src/VideoSupport.vala
index 6543cf5..791a12a 100644
--- a/src/VideoSupport.vala
+++ b/src/VideoSupport.vala
@@ -368,12 +368,12 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
     
         // initialize GStreamer, but don't pass it our actual command line arguments -- we don't
         // want our end users to be able to parameterize the GStreamer configuration
-        string[] fake_args = new string[0];
-        unowned string[] fake_unowned_args = fake_args;
-        Gst.init(ref fake_unowned_args);
-        
+        unowned string[] args = null;
+        Gst.init(ref args);
+
+        var registry = Gst.Registry.@get ();
         int saved_state = Config.Facade.get_instance().get_video_interpreter_state_cookie();
-        current_state = (int) Gst.Registry.get().get_feature_list_cookie();
+        current_state = (int) registry.get_feature_list_cookie();
         if (saved_state == Config.Facade.NO_VIDEO_INTERPRETER_STATE) {
             message("interpreter state cookie not found; assuming all video thumbnails are out of date");
             interpreter_state_changed = true;
@@ -381,7 +381,25 @@ public class Video : VideoSource, Flaggable, Monitorable, Dateable {
             message("interpreter state has changed; video thumbnails may be out of date");
             interpreter_state_changed = true;
         }
-        
+
+        /* First do the cookie state handling, then update our local registry
+         * to not include vaapi stuff. This is basically to work-around
+         * concurrent access to VAAPI/X11 which it doesn't like, cf
+         * https://bugzilla.gnome.org/show_bug.cgi?id=762416
+         */
+
+        var feature = registry.find_feature ("vaapidecodebin",
+                                             typeof (Gst.ElementFactory));
+        if (feature != null) {
+            registry.remove_feature (feature);
+        }
+
+        feature = registry.find_feature ("vaapidecode",
+                                         typeof (Gst.ElementFactory));
+        if (feature != null) {
+            registry.remove_feature (feature);
+        }
+
         global = new VideoSourceCollection();
         
         Gee.ArrayList<VideoRow?> all = VideoTable.get_instance().get_all();
diff --git a/thumbnailer/shotwell-video-thumbnailer.vala b/thumbnailer/shotwell-video-thumbnailer.vala
index 437d132..234868a 100644
--- a/thumbnailer/shotwell-video-thumbnailer.vala
+++ b/thumbnailer/shotwell-video-thumbnailer.vala
@@ -21,7 +21,21 @@ class ShotwellThumbnailer {
         Gst.StateChangeReturn ret;
         
         Gst.init(ref args);
-        
+
+        var registry = Gst.Registry.@get ();
+
+        var feature = registry.find_feature ("vaapidecodebin",
+                                             typeof (Gst.ElementFactory));
+        if (feature != null) {
+            registry.remove_feature (feature);
+        }
+
+        feature = registry.find_feature ("vaapidecode",
+                                             typeof (Gst.ElementFactory));
+        if (feature != null) {
+            registry.remove_feature (feature);
+        }
+
         if (args.length != 2) {
             stdout.printf("usage: %s [filename]\n Writes video thumbnail to stdout\n", args[0]);
             return 1;


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