[gnome-music/wip/jfelder/3-38-fix-gstplayer-stopped-state] gstplayer: Fix change to stopped state
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/jfelder/3-38-fix-gstplayer-stopped-state] gstplayer: Fix change to stopped state
- Date: Mon, 22 Mar 2021 13:36:26 +0000 (UTC)
commit 977299099992259cc9c858ec6f72115174b3b091
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 978a0e8dc..4ab3ad68b 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]