From c369b2cdc4a7839e5f1d920f702ea32ae7b29fed Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 17 Mar 2021 16:01:11 +0000
Subject: [PATCH] pv-wrap: Configure PulseAudio as default in /etc/asound.conf

This fixes two separate issues:

* It's parsed by all known versions of libasound.so.2, so it will work
  for both Steam Runtime 1 'scout' and Steam Runtime 2 'soldier', as
  well as future runtimes. Previously, we were using a path that only
  works in runtimes newer than scout.
* It's a direct child of /etc, which in our case is a tmpfs, so we
  don't need to worry about whether we will be able to create a mount
  point in a subdirectory.

Fixes: 1b720eb7 "wrap: Set PulseAudio as the default ALSA driver if available"
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/runtime.c | 1 +
 pressure-vessel/wrap.c    | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index b7cfeba60..65d376678 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -2203,6 +2203,7 @@ bind_runtime_base (PvRuntime *self,
   };
   static const char * const dont_bind[] =
   {
+    "/etc/asound.conf",
     "/etc/localtime",
     "/etc/machine-id",
     "/var/cache/ldconfig",
diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index 86b34a6d6..ebed24d0a 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -2428,9 +2428,9 @@ main (int argc,
       const gchar *alsa_config = "pcm.!default pulse\n"
                                  "ctl.!default pulse\n";
 
-      flatpak_bwrap_add_args_data (bwrap, "99-pulseaudio-default.conf",
+      flatpak_bwrap_add_args_data (bwrap, "asound.conf",
                                    alsa_config, -1,
-                                   "/etc/alsa/conf.d/99-pulseaudio-default.conf",
+                                   "/etc/asound.conf",
                                    NULL);
     }
 
-- 
GitLab