public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/quodlibet] f44: Apply upstream volume reset fix
@ 2026-10-04 17:03 LuK1337
  0 siblings, 0 replies; only message in thread
From: LuK1337 @ 2026-10-04 17:03 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/quodlibet
Branch : f44
Commit : 1ee9e3f025d922bb374423101a2eccdc8f6442a4
Author : LuK1337 <priv.luk@gmail.com>
Date   : 2026-10-04T18:58:36+02:00
Stats  : +105/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/quodlibet/c/1ee9e3f025d922bb374423101a2eccdc8f6442a4?branch=f44

Log:
Apply upstream volume reset fix

---
diff --git a/319942061927b4968e7e1cc63c9df1c256f92de1.patch b/319942061927b4968e7e1cc63c9df1c256f92de1.patch
new file mode 100644
index 0000000..f4cc9aa
--- /dev/null
+++ b/319942061927b4968e7e1cc63c9df1c256f92de1.patch
@@ -0,0 +1,103 @@
+From 319942061927b4968e7e1cc63c9df1c256f92de1 Mon Sep 17 00:00:00 2001
+From: LuK1337 <priv.luk@gmail.com>
+Date: Mon, 28 Sep 2026 14:54:05 +0200
+Subject: [PATCH] gstbe: Keep external volume/mute state across pipeline
+ rebuilds
+
+With pulsesink (e.g. on PipeWire) the stream volume is supposed to be
+restored by the server for each new stream. Since the pipeline gets
+recreated on every manual song change, the new stream is sometimes
+created while the old one is still going away and starts at 100%
+volume instead, which then also gets stored as the restore value.
+
+Remember the external volume/mute state when destroying the pipeline
+and pass it on to the sink of the next one.
+
+Assisted-by: LLM
+---
+ quodlibet/player/gstbe/player.py | 12 ++++++++++--
+ tests/test_player.py             | 27 +++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 2 deletions(-)
+
+diff --git a/quodlibet/player/gstbe/player.py b/quodlibet/player/gstbe/player.py
+index e72c2a5c73..b1e7dad01d 100644
+--- a/quodlibet/player/gstbe/player.py
++++ b/quodlibet/player/gstbe/player.py
+@@ -354,6 +354,7 @@ class GStreamerPlayer(BasePlayer, GStreamerPluginHandler):
+         self._volume = 1.0
+         self._paused = True
+         self._mute = False
++        self._ext_state_known = False
+ 
+         self._in_gapless_transition = False
+         self._active_error = False
+@@ -557,8 +558,9 @@ class GStreamerPlayer(BasePlayer, GStreamerPluginHandler):
+         flags &= ~(GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT)
+         self.bin.set_property("flags", flags)
+ 
+-        if not self.has_external_volume:
+-            # Restore volume/ReplayGain and mute state
++        if not self.has_external_volume or self._ext_state_known:
++            # Restore volume/ReplayGain and mute state. Also for external
++            # sinks, as new pulsesink streams sometimes start at 100%.
+             self.props.volume = self._volume
+             self.mute = self._mute
+ 
+@@ -575,6 +577,12 @@ class GStreamerPlayer(BasePlayer, GStreamerPluginHandler):
+ 
+     def __destroy_pipeline(self):
+         print_d("Destroying Gstreamer pipeline")
++
++        if self.bin and self.has_external_volume:
++            self._volume = self.props.volume
++            self._mute = self.props.mute
++            self._ext_state_known = True
++
+         self._remove_plugin_elements()
+ 
+         if self.__bus_id:
+diff --git a/tests/test_player.py b/tests/test_player.py
+index 5161218cef..5fdd251375 100644
+--- a/tests/test_player.py
++++ b/tests/test_player.py
+@@ -18,6 +18,7 @@ from quodlibet.formats import AudioFile
+ from quodlibet.qltk.songmodel import PlaylistModel
+ from quodlibet.qltk.controls import Volume
+ 
++from unittest import mock
+ 
+ FILES = [
+     AudioFile({"~filename": fsnative("/foo/bar1"), "title": "1"}),
+@@ -387,6 +388,32 @@ class TGstPlayer(TPlayer, TPlayerMixin):
+         assert self.player.can_play_uri("file://")
+         assert not self.player.can_play_uri("fake://")
+ 
++    def test_external_volume_kept_on_song_change(self):
++        from gi.repository import Gst
++        from quodlibet.player.gstbe import player as gstplayer
++
++        # Every new pipeline gets a fresh sink with the default state,
++        # like a new pulsesink stream which the server failed to restore
++        def new_sink(desc):
++            return [Gst.ElementFactory.make("volume", None)], "volume"
++
++        with (
++            mock.patch.object(gstplayer, "gstreamer_sink", new_sink),
++            mock.patch.object(gstplayer, "sink_has_external_state", lambda s: True),
++            mock.patch.object(gstplayer, "sink_state_is_valid", lambda s: True),
++        ):
++            self.player.go_to(FILES[0])
++            self.player.paused = False
++            assert self.player.has_external_volume
++            self.player.volume = 0.5
++            self.player.mute = True
++
++            self.player.next()
++            assert self.player.bin
++            self.assertAlmostEqual(self.player.volume, 0.5)
++            assert self.player.mute
++            self.player.stop()
++
+ 
+ class TVolume(TestCase):
+     def setUp(self):

diff --git a/quodlibet.spec b/quodlibet.spec
index 6ad409c..51006d1 100644
--- a/quodlibet.spec
+++ b/quodlibet.spec
@@ -24,6 +24,8 @@ Patch:		https://github.com/quodlibet/quodlibet/commit/2742dc8da188d4da4a45f77554
 Patch:		https://github.com/quodlibet/quodlibet/commit/060c938a13249c2809fece6e8e11c088783887f8.patch
 # https://github.com/quodlibet/quodlibet/pull/4910
 Patch:		https://github.com/quodlibet/quodlibet/commit/ab9d2b040e71887117b6395b29aa5815f7c976ec.patch
+# https://github.com/quodlibet/quodlibet/pull/4934
+Patch:		https://github.com/quodlibet/quodlibet/commit/319942061927b4968e7e1cc63c9df1c256f92de1.patch
 
 BuildArch:	noarch
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-04 17:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-04 17:03 [rpms/quodlibet] f44: Apply upstream volume reset fix LuK1337

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox