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




commit d5f249a4957a8d5eccddeb84c93f07180371671c
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 recieved (see
    
    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]