import pulseaudio-14.0-4.el8

c8 imports/c8/pulseaudio-14.0-4.el8
CentOS Sources 2 years ago committed by MSVSphere Packaging Team
commit 119b5baeda

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/pulseaudio-14.0.tar.xz

@ -0,0 +1 @@
c37a8551993ed045b3fa55176c9d1df4d2ed17a1 SOURCES/pulseaudio-14.0.tar.xz

@ -0,0 +1,122 @@
From 832d7ac1144416306de1b6990d70115079bd1935 Mon Sep 17 00:00:00 2001
From: Hui Wang <hui.wang@canonical.com>
Date: Fri, 21 Aug 2020 17:34:25 +0800
Subject: [PATCH] alsa-card: add dynamic priority bonus base for alsa profiles
After applying the commit 0d50e787 ("alsa-card: improve the profile
availability logic"), we met an new issue. when system selects the
initial profile, the profile off is selected instead of a profile with
a valid output device on it. That is the issue we met:
Profiles:
HiFi: Default (sinks: 2, sources: 2, priority: 8000, available: no)
off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
Active Profile: off
Ports:
[Out] Headphones: Headphones (priority: 300, latency offset: 0 usec, not available)
Part of profile(s): HiFi
[Out] Speaker: Speaker (priority: 100, latency offset: 0 usec)
Part of profile(s): HiFi
...
I know the commit 0d50e787 really fixed something, but we still need
to fix the new issue, to do so, this patch introduces a priority bonus
for alsa profiles and separate the alsa profiles to 3 groups:
group a (will be granted priority bonus dynamically):
a profile has only output ports and at least one port is not unavailable
a profile has only input ports and at least one port is not unavailable
a profile has both input and output ports, and at least one output and
one input ports are not unavailable
group b (will be marked unavailable)
a profile has only output ports and all ports are unavailable
a profile has only input ports and all ports are unavailable
a profile has both output and input ports, and all ports are unavailable
group c
the rest profiles, their priority and availability is not changed.
With this change, the profile HiFi will become avaialbe:yes, and will
not be granted priority bonus if no input port is plugged.
The priority bonus provides a higher priority base to profiles, this
guarantees this patch doesn't break the fix of 0d50e787.
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/927
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/355>
---
src/modules/alsa/module-alsa-card.c | 35 ++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
index de2fe9cc4..5349314b5 100644
--- a/src/modules/alsa/module-alsa-card.c
+++ b/src/modules/alsa/module-alsa-card.c
@@ -104,6 +104,13 @@ static const char* const valid_modargs[] = {
#define DEFAULT_DEVICE_ID "0"
+/* dynamic profile priority bonus, for all alsa profiles, the original priority
+ needs to be less than 0x7fff (32767), then could apply the rule of priority
+ bonus. So far there are 2 kinds of alsa profiles, one is from alsa ucm, the
+ other is from mixer profile-sets, their priorities are all far less than 0x7fff
+*/
+#define PROFILE_PRIO_BONUS 0x8000
+
struct userdata {
pa_core *core;
pa_module *module;
@@ -459,9 +466,19 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
* as available (well, "unknown" to be precise, but there's little
* practical difference).
*
- * When all output ports are unavailable, we know that all sinks are
- * unavailable, and therefore the profile is marked unavailable as well.
- * The same applies to input ports as well, of course.
+ * A profile will be marked unavailable:
+ * only contains output ports and all ports are unavailable
+ * only contains input ports and all ports are unavailable
+ * contains both input and output ports and all ports are unavailable
+ *
+ * A profile will be awarded priority bonus:
+ * only contains output ports and at least one port is available
+ * only contains input ports and at least one port is available
+ * contains both output and input ports and at least one output port
+ * and one input port are available
+ *
+ * The rest profiles will not be marked unavailable and will not be
+ * awarded priority bonus
*
* If there are no output ports at all, but the profile contains at least
* one sink, then the output is considered to be available. */
@@ -476,6 +493,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
bool found_available_output_port = false;
pa_available_t available = PA_AVAILABLE_UNKNOWN;
+ profile->priority &= ~PROFILE_PRIO_BONUS;
PA_HASHMAP_FOREACH(port, u->card->ports, state2) {
if (!pa_hashmap_get(port->profiles, profile->name))
continue;
@@ -493,8 +511,15 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
}
}
- if ((has_input_port && !found_available_input_port) || (has_output_port && !found_available_output_port))
- available = PA_AVAILABLE_NO;
+ if ((has_input_port && found_available_input_port && !has_output_port) ||
+ (has_output_port && found_available_output_port && !has_input_port) ||
+ (has_input_port && found_available_input_port && has_output_port && found_available_output_port))
+ profile->priority |= PROFILE_PRIO_BONUS;
+
+ if ((has_input_port && !found_available_input_port && has_output_port && !found_available_output_port) ||
+ (has_input_port && !found_available_input_port && !has_output_port) ||
+ (has_output_port && !found_available_output_port && !has_input_port))
+ available = PA_AVAILABLE_NO;
/* We want to update the active profile's status last, so logic that
* may change the active profile based on profile availability status
--
2.36.1

@ -0,0 +1,94 @@
From e50ec0deb7c20d1daa26cc7eab5a1ff75b9f7bf8 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 17 Nov 2021 12:28:23 +0100
Subject: [PATCH] bluez5: do NameHasOwner before using org.bluez
We should not be using org.bluez when the bluetooth service is not
running or else we might try to activate it. The activation of the
bluetooth service should be done at boot time.
---
src/modules/bluetooth/bluez5-util.c | 61 ++++++++++++++++++++++++++++-
1 file changed, 60 insertions(+), 1 deletion(-)
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
index a21896ede..282886e45 100644
--- a/src/modules/bluetooth/bluez5-util.c
+++ b/src/modules/bluetooth/bluez5-util.c
@@ -1095,6 +1095,65 @@ static void get_managed_objects(pa_bluetooth_discovery *y) {
send_and_add_to_pending(y, m, get_managed_objects_reply, NULL);
}
+static void check_name_owner_reply(DBusPendingCall *pending, void *userdata) {
+ pa_dbus_pending *p;
+ pa_bluetooth_discovery *y;
+ DBusMessage *r;
+ DBusError err;
+ bool running;
+
+ pa_assert_se(p = userdata);
+ pa_assert_se(y = p->context_data);
+ pa_assert_se(r = dbus_pending_call_steal_reply(pending));
+
+ if (dbus_message_is_error(r, DBUS_ERROR_UNKNOWN_METHOD)) {
+ pa_log_warn("BlueZ D-Bus ObjectManager not available");
+ goto finish;
+ }
+
+ if (dbus_message_get_type(r) == DBUS_MESSAGE_TYPE_ERROR) {
+ pa_log_error("NameHasOwner() failed: %s: %s", dbus_message_get_error_name(r), pa_dbus_get_error_message(r));
+ goto finish;
+ }
+
+ if (!pa_streq(dbus_message_get_signature(r), "b")) {
+ pa_log_error("Invalid reply signature for NameHasOwner()");
+ goto finish;
+ }
+
+ dbus_error_init(&err);
+ if (!dbus_message_get_args(r, &err, DBUS_TYPE_BOOLEAN, &running, DBUS_TYPE_INVALID)) {
+ pa_log_error("Could not check bluetooth service: %s", err.message);
+ dbus_error_free(&err);
+ goto finish;
+ }
+
+ pa_log_info("bluetooth service running: %s", running ? "yes" : "no");
+ if (running)
+ get_managed_objects(y);
+
+finish:
+ dbus_message_unref(r);
+
+ PA_LLIST_REMOVE(pa_dbus_pending, y->pending, p);
+ pa_dbus_pending_free(p);
+}
+
+static void check_name_owner(pa_bluetooth_discovery *y) {
+ DBusMessage *m;
+ const char *service = BLUEZ_SERVICE;
+
+ pa_assert(y);
+
+ pa_assert_se(m = dbus_message_new_method_call("org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "NameHasOwner"));
+ dbus_message_append_args(m, DBUS_TYPE_STRING, &service, DBUS_TYPE_INVALID);
+
+ send_and_add_to_pending(y, m, check_name_owner_reply, NULL);
+}
+
pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook) {
pa_assert(y);
pa_assert(PA_REFCNT_VALUE(y) > 0);
@@ -1653,7 +1712,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c, int headset_backe
pa_xfree(endpoint);
}
- get_managed_objects(y);
+ check_name_owner(y);
return y;
--
2.36.1

@ -0,0 +1,10 @@
load-module module-device-restore
load-module module-card-restore
load-module module-udev-detect
load-module module-native-protocol-unix
load-module module-default-device-restore
load-module module-rescue-streams
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle
load-module module-position-event-sounds

@ -0,0 +1,24 @@
diff -up pulseaudio-11.1/src/pulse/client-conf.c.autospawn pulseaudio-11.1/src/pulse/client-conf.c
--- pulseaudio-11.1/src/pulse/client-conf.c.autospawn 2018-03-01 15:52:25.304612437 -0600
+++ pulseaudio-11.1/src/pulse/client-conf.c 2018-03-01 15:56:17.643552698 -0600
@@ -63,7 +63,7 @@ static const pa_client_conf default_conf
.cookie_from_x11_valid = false,
.cookie_file_from_application = NULL,
.cookie_file_from_client_conf = NULL,
- .autospawn = true,
+ .autospawn = false,
.disable_shm = false,
.disable_memfd = false,
.shm_size = 0,
diff -up pulseaudio-11.1/src/pulse/client.conf.in.autospawn pulseaudio-11.1/src/pulse/client.conf.in
--- pulseaudio-11.1/src/pulse/client.conf.in.autospawn 2016-08-23 07:50:10.000000000 -0500
+++ pulseaudio-11.1/src/pulse/client.conf.in 2018-03-01 15:56:01.201344622 -0600
@@ -22,7 +22,7 @@
; default-server =
; default-dbus-server =
-; autospawn = yes
+; autospawn = no
; daemon-binary = @PA_BINARY@
; extra-arguments = --log-target=syslog

@ -0,0 +1 @@
a834775d9382b055504e5ee7625dc50768daac29329531deb6597bf05e06c261 pulseaudio-14.0.tar.xz

@ -0,0 +1,12 @@
--- pulseaudio-13.99.1/src/daemon/start-pulseaudio-x11.in 2020-05-11 17:35:39.857484912 +0200
+++ pulseaudio-13.99.1.new/src/daemon/start-pulseaudio-x11.in 2020-05-11 17:35:53.041199783 +0200
@@ -17,6 +17,9 @@
set -e
+# probe to test if autospawn works, else resort to starting manually
+@PACTL_BINARY@ info > /dev/null 2>&1 || @PA_BINARY@ --start "$@"
+
if [ x"$DISPLAY" != x ] ; then
@PACTL_BINARY@ load-module module-x11-publish "display=$DISPLAY xauthority=$XAUTHORITY" > /dev/null

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save