unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: raingloom@riseup.net
Cc: 38172@debbugs.gnu.org
Subject: bug#38172: WebkitGTK-based browsers: System volume suddenly maxed out when playing audio or video
Date: Thu, 09 Jan 2020 02:22:23 +0100	[thread overview]
Message-ID: <1e5ef8c196053fbeada65e8f525520fb6483530f.camel@student.tugraz.at> (raw)
In-Reply-To: 54496e7bbfd36f00b982bcdfe0557864d1f7938b.camel@riseup.net

[-- Attachment #1: Type: text/plain, Size: 993 bytes --]

Hi Guix,

After looking at my older patch (which no longer cleanly applies), I've
noticed, that pulseaudio doesn't even read the files from /etc.  This
is troublesome in multiple ways.  For one, pulseaudio causes >500
rebuilds (with >900 dependent packages) and is therefore staging
material, for the other, hardcoding /etc in such a way breaks
pulseaudio without the service.

So far, I've only tested containers via `guix environment --container`, 
but from what I can gather with strace, the config file is indeed read
and hence flat-volumes are eliminated.  Other ways of making pulseaudio
accept /etc are very welcome.  Looking at Nix, they configure
pulseaudio with "--sysconfdir=/etc", but then override sysconfdir and
pulseconfdir during install.  I'm not quite sure which solution is
"better", but neither is going to read the config shipped with the
package.

Note: before this can be applied on staging,
a66ee82a05d8ff1ef7c5ff9ac7723cb32fc4e22a needs to be applied.

Regards,
Leo



[-- Attachment #2: 0001-services-Add-pulseaudio-configuration.patch --]
[-- Type: text/x-patch, Size: 3312 bytes --]

From bf4708923d14356c87daec69209b30aa0427d64f Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Wed, 8 Jan 2020 19:50:51 +0100
Subject: [PATCH 1/3] services: Add pulseaudio-configuration.

* gnu/services/sound (<pulseaudio-configuration>): New record.
(pulseaudio-etc): New procedure.
(pulseaudio-service-type): Update accordingly.
---
 gnu/services/sound.scm | 47 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/gnu/services/sound.scm b/gnu/services/sound.scm
index aaca733729..f01d958ce7 100644
--- a/gnu/services/sound.scm
+++ b/gnu/services/sound.scm
@@ -34,6 +34,7 @@
   #:export (alsa-configuration
             alsa-service-type
 
+            pulseaudio-configuration
             pulseaudio-service-type))
 
 ;;; Commentary:
@@ -106,19 +107,61 @@ ctl.!default {
 ;;; PulseAudio
 ;;;
 
+(define-record-type* <pulseaudio-configuration>
+  pulseaudio-configuration make-pulseaudio-configuration
+  pulseaudio-configuration?
+  (package pulseaudio-package (default pulseaudio))
+  (client-conf pulseaudio-client-conf (default '()))
+  (daemon-conf pulseaudio-daemon-conf (default '((flat-volumes no))))
+  (default-script pulseaudio-default-script (default #f))
+  (system-script pulseaudio-system-script (default #f)))
+
 (define (pulseaudio-environment config)
   ;; Define this variable in the global environment such that
   ;; pulseaudio swh-plugins works.
   `(("LADSPA_PATH"
      . ,(file-append swh-plugins "/lib/ladspa"))))
 
+(define (pulseaudio-conf-entry arg)
+  (match arg
+    ((key value)
+     (format #f "~a = ~s~%" key value))
+    ((? string? _)
+     (string-append arg "\n"))))
+
+(define pulseaudio-etc
+  (match-lambda
+    (($ <pulseaudio-configuration> package client-conf daemon-conf
+                                   default-script system-script)
+     (let ((default.pa (if default-script
+                           (apply mixed-text-file "default.pa"
+                                  default-script)
+                           (file-append package "/etc/pulse/default.pa"))))
+       `(("pulse"
+          ,(file-union
+            "pulse"
+            `(("client.conf"
+               ,(apply mixed-text-file "client.conf"
+                       (map pulseaudio-conf-entry client-conf)))
+              ("daemon.conf"
+               ,(apply mixed-text-file "daemon.conf"
+                       "default-script-file = " default.pa "\n"
+                       (map pulseaudio-conf-entry daemon-conf)))
+              ("default.pa" ,default.pa)
+              ("system.pa"
+               ,(if system-script
+                    (apply mixed-text-file "system.pa"
+                           system-script)
+                    (file-append package "/etc/pulse/system.pa")))))))))))
+
 (define pulseaudio-service-type
   (service-type
    (name 'pulseaudio)
    (extensions
     (list (service-extension session-environment-service-type
-                             pulseaudio-environment)))
-   (default-value #f)
+                             pulseaudio-environment)
+          (service-extension etc-service-type pulseaudio-etc)))
+   (default-value (pulseaudio-configuration))
    (description "Configure PulseAudio sound support.")))
 
 ;;; sound.scm ends here
-- 
2.24.1


[-- Attachment #3: 0002-gnu-pulseaudio-Honor-etc.patch --]
[-- Type: text/x-patch, Size: 1237 bytes --]

From 843d3968db990b5b7ff3f618db5847f83b999cb8 Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Thu, 9 Jan 2020 01:24:09 +0100
Subject: [PATCH 2/3] gnu: pulseaudio: Honor /etc.

* gnu/packages/pulseaudio.scm (pulseaudio) [phases]:
Set PA_DEFAULT_CONFIG_DIR to "/etc/pulse".
---
 gnu/packages/pulseaudio.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/pulseaudio.scm b/gnu/packages/pulseaudio.scm
index 671dcd1563..1fb5a2f578 100644
--- a/gnu/packages/pulseaudio.scm
+++ b/gnu/packages/pulseaudio.scm
@@ -161,6 +161,11 @@ rates.")
                                               (assoc-ref %outputs "out")
                                               "/lib/udev/rules.d"))
        #:phases (modify-phases %standard-phases
+                 (add-after 'configure 'hardcode-default-config-dir
+                   (lambda _
+                     (substitute* "config.h"
+                       (("(#define PA_DEFAULT_CONFIG_DIR).*$" all prefix)
+                        (string-append prefix " \"/etc/pulse\"")))))
                  (add-before 'check 'pre-check
                    (lambda _
                      ;; 'tests/lock-autospawn-test.c' wants to create a file
-- 
2.24.1


[-- Attachment #4: 0003-services-Add-pulseaudio-to-desktop-services.patch --]
[-- Type: text/x-patch, Size: 760 bytes --]

From e24016f9a44a113847dd937ac47ab4bdb960236d Mon Sep 17 00:00:00 2001
From: Leo Prikler <leo.prikler@student.tugraz.at>
Date: Thu, 9 Jan 2020 01:29:13 +0100
Subject: [PATCH 3/3] services: Add pulseaudio to %desktop-services.

* gnu/services/desktop.scm (%desktop-services): Add pulseaudio service.
---
 gnu/services/desktop.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index b40622a637..1be05fda4e 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1183,6 +1183,7 @@ or setting its password with passwd.")))
 
          x11-socket-directory-service
 
+         (service pulseaudio-service-type)
          (service alsa-service-type)
 
          %base-services))
-- 
2.24.1


  parent reply	other threads:[~2020-01-09  1:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e9aba2fd590811bda70b65036f682b764c7141cf.camel@student.tugraz.at>
2019-11-11 21:09 ` bug#38172: fixing dangerous PulseAudio defaults and giving it a record type raingloom
2019-11-12 11:00   ` Leo Prikler
2020-01-09  1:22   ` Leo Prikler [this message]
2020-01-09 20:48     ` bug#38172: WebkitGTK-based browsers: System volume suddenly maxed out when playing audio or video Marius Bakke
2020-01-09 22:49       ` Leo Prikler
2020-01-11 16:48         ` Marius Bakke
     [not found] <pz4LLjGMExF6yjrqndx7uhuXMNQf95pbQOvVNBU16OrH7JDuHoTlsT3pzgAaUhRCyPB9QzgZP2gUO_D0H_gQbOrjG1yVWbf7_u5vYdpSzdw=@protonmail.com>
2020-01-07  6:07 ` raingloom

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=1e5ef8c196053fbeada65e8f525520fb6483530f.camel@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=38172@debbugs.gnu.org \
    --cc=raingloom@riseup.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).