[gnome-music/wip/jfelder/player-fix-stopped-state-change] gstplayer: Fix change to stopped state




commit 03b59bf172101cf621dc231e5eabffd0bfdef75a
Author: Jean Felder <jfelder src gnome org>
Date:   Wed Feb 24 19:35:59 2021 +0100

    gstplayer: Fix change to stopped state
    
    Since commit 703692e9, gstplayer state changes are asynchronous. It
    relies on listening to the "state-changed" message from the pipeline
    to update its state. However, changing the state to NULL (ie. STOPPED
    in gstplayer terminology) flushes the pipeline. Thus, the change
    message never arrives.
    This results in the playbar staying in a weird state at the end of a
    playlist because the STOPPED state change is never received.
    
    This issue is fixed by changing gstplayer state to STOPPED when this
    state is requested.
    
    Closes: https://gitlab.gnome.org/GNOME/gnome-music/-/issues/411

 gnomemusic/gstplayer.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gnomemusic/gstplayer.py b/gnomemusic/gstplayer.py
index cb248fd88..9d5915218 100644
--- a/gnomemusic/gstplayer.py
+++ b/gnomemusic/gstplayer.py
@@ -224,7 +224,11 @@ class GstPlayer(GObject.GObject):
         if state == Playback.PAUSED:
             self._player.set_state(Gst.State.PAUSED)
         if state == Playback.STOPPED:
+            # Changing the state to NULL flushes the pipeline.
+            # Thus, the change message never arrives.
             self._player.set_state(Gst.State.NULL)
+            self._state = Playback.STOPPED
+            self.notify("state")
         if state == Playback.LOADING:
             self._player.set_state(Gst.State.READY)
         if state == Playback.PLAYING:


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