public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: LuK1337 <priv.luk@gmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/quodlibet] rawhide: Apply upstream volume reset fix
Date: Sun, 04 Oct 2026 17:02:40 GMT	[thread overview]
Message-ID: <179113336047.1.4906599024030065017.rpms-quodlibet-1ee9e3f025d9@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/quodlibet
Branch : rawhide
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=rawhide

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
 

                 reply	other threads:[~2026-10-04 17:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179113336047.1.4906599024030065017.rpms-quodlibet-1ee9e3f025d9@fedoraproject.org \
    --to=priv.luk@gmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox