forked from pool/wireplumber
Accepting request 947467 from home:alarrosa:branches:multimedia:libs
- Add patches from a MR to fix glfo#pipewire/wireplumber#162 (fix audio in virtual machines with pipewire): * 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch * 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch OBS-URL: https://build.opensuse.org/request/show/947467 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/wireplumber?expand=0&rev=21
This commit is contained in:
parent
8fc7b977aa
commit
220b575aae
101
0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch
Normal file
101
0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch
Normal file
@ -0,0 +1,101 @@
|
||||
From db728c2f7fff23446feeeaf3b3f16189a18a8f1e Mon Sep 17 00:00:00 2001
|
||||
From: Julian Bouzas <julian.bouzas@collabora.com>
|
||||
Date: Fri, 14 Jan 2022 14:34:38 -0500
|
||||
Subject: [PATCH] core: add API to check if running in a virtual machine
|
||||
|
||||
---
|
||||
lib/wp/core.c | 26 ++++++++++++++++++++++++++
|
||||
lib/wp/core.h | 5 +++++
|
||||
modules/module-lua-scripting/api.c | 9 +++++++++
|
||||
3 files changed, 40 insertions(+)
|
||||
|
||||
diff --git a/lib/wp/core.c b/lib/wp/core.c
|
||||
index 23f6f35f..3713135c 100644
|
||||
--- a/lib/wp/core.c
|
||||
+++ b/lib/wp/core.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <pipewire/pipewire.h>
|
||||
|
||||
#include <spa/utils/result.h>
|
||||
+#include <spa/support/cpu.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
||||
/*
|
||||
@@ -986,6 +987,31 @@ wp_core_get_registry (WpCore * self)
|
||||
return &self->registry;
|
||||
}
|
||||
|
||||
+/*!
|
||||
+ * \brief Checks whether core is a guest running in a virtual machine or not.
|
||||
+ *
|
||||
+ * \ingroup wpcore
|
||||
+ * \param self the core
|
||||
+ * \returns: TRUE if core is a guest, FALSE otherwise
|
||||
+ */
|
||||
+gboolean
|
||||
+wp_core_is_guest (WpCore * self)
|
||||
+{
|
||||
+ const struct spa_support *support;
|
||||
+ uint32_t n_support;
|
||||
+ struct spa_cpu *cpu;
|
||||
+
|
||||
+ g_return_val_if_fail (WP_IS_CORE (self), FALSE);
|
||||
+ g_return_val_if_fail (self->pw_context, FALSE);
|
||||
+
|
||||
+ support = pw_context_get_support (self->pw_context, &n_support);
|
||||
+ cpu = spa_support_find (support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||
+ if (!cpu)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ return spa_cpu_get_vm_type (cpu) != SPA_CPU_VM_NONE;
|
||||
+}
|
||||
+
|
||||
WpCore *
|
||||
wp_registry_get_core (WpRegistry * self)
|
||||
{
|
||||
diff --git a/lib/wp/core.h b/lib/wp/core.h
|
||||
index 07a6125b..8efb922d 100644
|
||||
--- a/lib/wp/core.h
|
||||
+++ b/lib/wp/core.h
|
||||
@@ -115,6 +115,11 @@ WP_API
|
||||
gboolean wp_core_sync_finish (WpCore * self, GAsyncResult * res,
|
||||
GError ** error);
|
||||
|
||||
+/* Misc */
|
||||
+
|
||||
+WP_API
|
||||
+gboolean wp_core_is_guest (WpCore * self);
|
||||
+
|
||||
/* Object Manager */
|
||||
|
||||
WP_API
|
||||
diff --git a/modules/module-lua-scripting/api.c b/modules/module-lua-scripting/api.c
|
||||
index 876b4f6f..27033027 100644
|
||||
--- a/modules/module-lua-scripting/api.c
|
||||
+++ b/modules/module-lua-scripting/api.c
|
||||
@@ -228,6 +228,14 @@ core_require_api (lua_State *L)
|
||||
return wp_require_api_transition_new_from_lua (L, core);
|
||||
}
|
||||
|
||||
+static int
|
||||
+core_is_guest (lua_State *L)
|
||||
+{
|
||||
+ WpCore * core = get_wp_core (L);
|
||||
+ lua_pushboolean (L, wp_core_is_guest (core));
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static const luaL_Reg core_funcs[] = {
|
||||
{ "get_info", core_get_info },
|
||||
{ "idle_add", core_idle_add },
|
||||
@@ -235,6 +243,7 @@ static const luaL_Reg core_funcs[] = {
|
||||
{ "sync", core_sync },
|
||||
{ "quit", core_quit },
|
||||
{ "require_api", core_require_api },
|
||||
+ { "is_guest", core_is_guest },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
--
|
||||
GitLab
|
||||
|
@ -0,0 +1,31 @@
|
||||
From ba2cd1cfd74de346ccc88028b6e1d6e95f055ba1 Mon Sep 17 00:00:00 2001
|
||||
From: Julian Bouzas <julian.bouzas@collabora.com>
|
||||
Date: Fri, 14 Jan 2022 14:35:58 -0500
|
||||
Subject: [PATCH] alsa-monitor: set period-size and headroom props if running
|
||||
in virtual machine
|
||||
|
||||
Fixes #162
|
||||
---
|
||||
src/scripts/monitors/alsa.lua | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
|
||||
index 3e8eda83..592a250d 100644
|
||||
--- a/src/scripts/monitors/alsa.lua
|
||||
+++ b/src/scripts/monitors/alsa.lua
|
||||
@@ -166,6 +166,12 @@ function createNode(parent, id, type, factory, properties)
|
||||
end
|
||||
end
|
||||
|
||||
+ -- apply virtual machine properties
|
||||
+ if Core.is_guest() then
|
||||
+ properties["api.alsa.period-size"] = 256
|
||||
+ properties["api.alsa.headroom"] = 8192
|
||||
+ end
|
||||
+
|
||||
-- apply properties from config.rules
|
||||
rulesApplyProperties(properties)
|
||||
if properties["node.disabled"] then
|
||||
--
|
||||
GitLab
|
||||
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 19 16:46:29 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>
|
||||
|
||||
- Add patches from a MR to fix glfo#pipewire/wireplumber#162 (fix
|
||||
audio in virtual machines with pipewire):
|
||||
* 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch
|
||||
* 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 14 15:59:55 UTC 2022 - Antonio Larrosa <alarrosa@suse.com>
|
||||
|
||||
|
@ -32,6 +32,8 @@ Source0: wireplumber-%{version}.tar.xz
|
||||
Source1: split-config-file.py
|
||||
Patch0: 0001-default-nodes-increase-priority-if-node-has-available-routes.patch
|
||||
Patch1: 0002-default-nodes-handle-nodes-without-Routes.patch
|
||||
Patch2: 0001-core-add-API-to-check-if-running-in-a-virtual-machine.patch
|
||||
Patch3: 0002-alsa-monitor-set-period-size-and-headroom-props-if-running-in-virtual-machine.patch
|
||||
Patch100: reduce-meson-required-version.patch
|
||||
# docs
|
||||
BuildRequires: doxygen
|
||||
|
Loading…
Reference in New Issue
Block a user