[banshee] GStreamerSharp: fix playback of subsequent videos



commit 670b5a4b7bdbc339ca5bd6628c5af530725c43d7
Author: Andrés G. Aragoneses <knocte gmail com>
Date:   Wed Oct 30 22:27:56 2013 +0100

    GStreamerSharp: fix playback of subsequent videos
    
    If the user tried to play a 2nd video (requesting it by hand, not just
    waiting for the 1st video to end), it would be rendered outside the
    NowPlaying area. This was because there was no way to invalidate
    previous overlays.
    
    By looking at the code of the unmanaged Banshee.GStreamer backend, I've
    noticed that:
    
     - In it, the invalidation happens more frequently (every time the
     function bp_video_find_video_overlay() is called.
     - The invalidation happens because of two possible events that call
     the former function:
       * bp_video_sink_element_added
       * bp_video_bus_element_sync_message
    
    The `element_added` and `sync_message` hooks are precisely the ones
    that are causing hangs in Banshee using the new managed GStreamerSharp
    backend, but since [1] I've managed to make video working without
    them (thanks to the Expose() call, but improving it later in [2]).
    
    Now, after this commit, video is completely fixed 100%, and by a
    means that doesn't happen so often as in the unmanaged backend, which
    means that this backend would have better performance, plus we get rid
    of unnecessary hooks (less code, less problems). (Anyway, we leave them
    commented for now, I'm more comfortable removing them a bit later.)
    
    Now we should be all set for the next phase: migration to Gst# 1.0
    bindings, which target GStreamer >= 1.0. (Something which is already
    work in progress.)
    
    [1] https://git.gnome.org/browse/banshee/commit/?id=96ee69d2534f12dd40aabd4e53ada7337a898f41
    [2] https://git.gnome.org/browse/banshee/commit/?id=4566e800b4b1402491251cba164f8deef20113f9

 .../Banshee.GStreamerSharp/PlayerEngine.cs         |    1 +
 .../Banshee.GStreamerSharp/VideoManager.cs         |   11 +++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs 
b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
index 256bd5f..55b63ac 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/PlayerEngine.cs
@@ -748,6 +748,7 @@ namespace Banshee.GStreamerSharp
         public override void Play ()
         {
             playbin.SetState (Gst.State.Playing);
+            video_manager.InvalidateOverlay ();
             video_manager.MaybePrepareOverlay ();
         }
 
diff --git a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/VideoManager.cs 
b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/VideoManager.cs
index c5e2bdb..6f2c243 100644
--- a/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/VideoManager.cs
+++ b/src/Backends/Banshee.GStreamerSharp/Banshee.GStreamerSharp/VideoManager.cs
@@ -79,8 +79,8 @@ namespace Banshee.GStreamerSharp
             
             playbin ["video-sink"] = videosink;
 
-            // FIXME: the 2 lines below (SyncHandler and ElementAdded), if uncommented, cause hangs (and 
commenting
-            //        them makes a 2nd video not play in the proper window, but it's better to have the 
latter bug)
+            // FIXME: the 2 lines below (SyncHandler and ElementAdded), if uncommented, cause hangs, and they
+            //        don't seem to be useful at this point anyway, remove?
             //playbin.Bus.SyncHandler = (bus, message) => {return bus.SyncSignalHandler (message); };
             playbin.Bus.SyncMessage += OnSyncMessage;
             //if (videosink is Bin) { ((Bin)videosink).ElementAdded += OnVideoSinkElementAdded; }
@@ -125,6 +125,13 @@ namespace Banshee.GStreamerSharp
             FindXOverlay ();
         }
 
+        internal void InvalidateOverlay ()
+        {
+            lock (video_mutex) {
+                xoverlay = null;
+            }
+        }
+
         internal bool MaybePrepareOverlay ()
         {
             if (!video_window_xid.HasValue) {


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