Accepting request 988946 from home:favogt:boo1201349
- Add patch to fix audio after tty switching (boo#1201349): * 0001-spa-alsa-udev-Check-accessibility-of-pcm-devices-as-.patch OBS-URL: https://build.opensuse.org/request/show/988946 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/pipewire?expand=0&rev=67
This commit is contained in:
parent
f8495c8ad0
commit
f2a9220bd1
@ -0,0 +1,74 @@
|
|||||||
|
From 0eb7f097129e35fba4aeeba518a2bc79d96fed44 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Fabian Vogt <fvogt@suse.de>
|
||||||
|
Date: Wed, 13 Jul 2022 10:47:22 +0200
|
||||||
|
Subject: [PATCH] spa/alsa-udev: Check accessibility of pcm devices as well
|
||||||
|
|
||||||
|
The order of attribute changes is random, so it's possible that controlCX is
|
||||||
|
accessible before the other devices, which marks the device as available but it
|
||||||
|
actually fails to open. Only consider the device accessible if both control and
|
||||||
|
PCM devices can be accessed.
|
||||||
|
|
||||||
|
This requires reacting to ATTRIB changes of pcm devices as well now.
|
||||||
|
|
||||||
|
Fixes #2534
|
||||||
|
---
|
||||||
|
spa/plugins/alsa/alsa-udev.c | 34 +++++++++++++++++++++++++++-------
|
||||||
|
1 file changed, 27 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/spa/plugins/alsa/alsa-udev.c b/spa/plugins/alsa/alsa-udev.c
|
||||||
|
index aa7b03994..8ee217d9d 100644
|
||||||
|
--- a/spa/plugins/alsa/alsa-udev.c
|
||||||
|
+++ b/spa/plugins/alsa/alsa-udev.c
|
||||||
|
@@ -538,11 +538,35 @@ static int emit_object_info(struct impl *this, struct device *device)
|
||||||
|
|
||||||
|
static bool check_access(struct impl *this, struct device *device)
|
||||||
|
{
|
||||||
|
- char path[128];
|
||||||
|
- bool accessible;
|
||||||
|
+ char path[128], prefix[32];
|
||||||
|
+ DIR *snd = NULL;
|
||||||
|
+ struct dirent *entry;
|
||||||
|
+ bool accessible = false;
|
||||||
|
|
||||||
|
snprintf(path, sizeof(path), "/dev/snd/controlC%u", device->id);
|
||||||
|
- accessible = access(path, R_OK|W_OK) >= 0;
|
||||||
|
+ if (access(path, R_OK|W_OK) >= 0 && (snd = opendir("/dev/snd"))) {
|
||||||
|
+ /*
|
||||||
|
+ * It's possible that controlCX is accessible before pcmCX* or
|
||||||
|
+ * the other way around. Return true only if all devices are
|
||||||
|
+ * accessible.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ accessible = true;
|
||||||
|
+ spa_scnprintf(prefix, sizeof(prefix), "pcmC%uD", device->id);
|
||||||
|
+ while ((entry = readdir(snd)) != NULL) {
|
||||||
|
+ if (!(entry->d_type == DT_CHR &&
|
||||||
|
+ spa_strstartswith(entry->d_name, prefix)))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ snprintf(path, sizeof(path), "/dev/snd/%.32s", entry->d_name);
|
||||||
|
+ if (access(path, R_OK|W_OK) < 0) {
|
||||||
|
+ accessible = false;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ closedir(snd);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (accessible != device->accessible)
|
||||||
|
spa_log_debug(this->log, "%s accessible:%u", path, accessible);
|
||||||
|
device->accessible = accessible;
|
||||||
|
@@ -655,10 +679,6 @@ static void impl_on_notify_events(struct spa_source *source)
|
||||||
|
/* Device becomes accessible or not busy */
|
||||||
|
if ((event->mask & (IN_ATTRIB | IN_CLOSE_WRITE))) {
|
||||||
|
bool access;
|
||||||
|
-
|
||||||
|
- if ((event->mask & IN_ATTRIB) &&
|
||||||
|
- spa_strstartswith(event->name, "pcm"))
|
||||||
|
- continue;
|
||||||
|
if (sscanf(event->name, "controlC%u", &id) != 1 &&
|
||||||
|
sscanf(event->name, "pcmC%uD", &id) != 1)
|
||||||
|
continue;
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 13 09:20:57 UTC 2022 - Fabian Vogt <fvogt@suse.com>
|
||||||
|
|
||||||
|
- Add patch to fix audio after tty switching (boo#1201349):
|
||||||
|
* 0001-spa-alsa-udev-Check-accessibility-of-pcm-devices-as-.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jul 7 08:50:16 UTC 2022 - Alexei Sorokin <sor.alexei@meowr.ru>
|
Thu Jul 7 08:50:16 UTC 2022 - Alexei Sorokin <sor.alexei@meowr.ru>
|
||||||
|
|
||||||
|
@ -64,6 +64,8 @@ Source0: %{name}-%{version}.tar.xz
|
|||||||
Source99: baselibs.conf
|
Source99: baselibs.conf
|
||||||
# PATCH-FIX-OPENSUSE reduce-meson-dependency.patch
|
# PATCH-FIX-OPENSUSE reduce-meson-dependency.patch
|
||||||
Patch0: reduce-meson-dependency.patch
|
Patch0: reduce-meson-dependency.patch
|
||||||
|
# PATCH-FIX-UPSTREAM https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1319
|
||||||
|
Patch1: 0001-spa-alsa-udev-Check-accessibility-of-pcm-devices-as-.patch
|
||||||
BuildRequires: docutils
|
BuildRequires: docutils
|
||||||
BuildRequires: doxygen
|
BuildRequires: doxygen
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
@ -334,6 +336,7 @@ This package provides a PulseAudio implementation based on PipeWire
|
|||||||
%if 0%{?sle_version} == 150300
|
%if 0%{?sle_version} == 150300
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%patch1 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if %{pkg_vcmp gcc < 8}
|
%if %{pkg_vcmp gcc < 8}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user