diff --git a/0001-alsa-add-api.alsa.auto-link-option.patch b/0001-alsa-add-api.alsa.auto-link-option.patch new file mode 100644 index 0000000..434d506 --- /dev/null +++ b/0001-alsa-add-api.alsa.auto-link-option.patch @@ -0,0 +1,73 @@ +From 896fea62c2072c836e6d821f7bdafe840ce8540e Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 9 Oct 2023 10:10:46 +0200 +Subject: [PATCH] alsa: add api.alsa.auto-link option + +Add an option to automatically use snd_pcm_link when the follower clock +is matching the driver. Only set this to true in pro-audio and when +nodes are scheduled together. + +See #3556 +--- + spa/plugins/alsa/acp/acp.c | 2 ++ + spa/plugins/alsa/alsa-pcm.c | 4 +++- + spa/plugins/alsa/alsa-pcm.h | 1 + + 3 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c +index 67b1e4654..127379fc4 100644 +--- a/spa/plugins/alsa/acp/acp.c ++++ b/spa/plugins/alsa/acp/acp.c +@@ -390,6 +390,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_proplist_setf(m->output_proplist, "device.profile.pro", "true"); + pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); ++ pa_proplist_set(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->output_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); +@@ -423,6 +424,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_proplist_setf(m->input_proplist, "device.profile.pro", "true"); + pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); ++ pa_proplist_set(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->input_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); +diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c +index ef148d76b..87dba34b0 100644 +--- a/spa/plugins/alsa/alsa-pcm.c ++++ b/spa/plugins/alsa/alsa-pcm.c +@@ -131,6 +131,8 @@ static int alsa_set_param(struct state *state, const char *k, const char *s) + state->multi_rate = spa_atob(s); + } else if (spa_streq(k, "api.alsa.htimestamp")) { + state->htimestamp = spa_atob(s); ++ } else if (spa_streq(k, "api.alsa.auto-link")) { ++ state->auto_link = spa_atob(s); + } else if (spa_streq(k, "latency.internal.rate")) { + state->process_latency.rate = atoi(s); + } else if (spa_streq(k, "latency.internal.ns")) { +@@ -3034,7 +3036,7 @@ int spa_alsa_prepare(struct state *state) + spa_list_for_each(follower, &state->followers, driver_link) { + if (follower != state && !follower->matching) { + spa_alsa_prepare(follower); +- if (!follower->linked) ++ if (!follower->linked && state->auto_link) + do_link(state, follower); + } + } +diff --git a/spa/plugins/alsa/alsa-pcm.h b/spa/plugins/alsa/alsa-pcm.h +index c770eeabb..ae4574526 100644 +--- a/spa/plugins/alsa/alsa-pcm.h ++++ b/spa/plugins/alsa/alsa-pcm.h +@@ -214,6 +214,7 @@ struct state { + unsigned int htimestamp:1; + unsigned int is_pro:1; + unsigned int sources_added:1; ++ unsigned int auto_link:1; + unsigned int linked:1; + + uint64_t iec958_codecs; +-- +GitLab + diff --git a/0002-acp-fix-compilation.patch b/0002-acp-fix-compilation.patch new file mode 100644 index 0000000..7c3d246 --- /dev/null +++ b/0002-acp-fix-compilation.patch @@ -0,0 +1,34 @@ +From 063805ccb49af859bd06a342ed107e61c9e11af4 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 9 Oct 2023 10:15:10 +0200 +Subject: [PATCH] acp: fix compilation + +--- + spa/plugins/alsa/acp/acp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c +index 127379fc4..1dbc0c2d7 100644 +--- a/spa/plugins/alsa/acp/acp.c ++++ b/spa/plugins/alsa/acp/acp.c +@@ -390,7 +390,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_proplist_setf(m->output_proplist, "device.profile.pro", "true"); + pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); +- pa_proplist_set(m->input_proplist, "api.alsa.auto-link", "true"); ++ pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->output_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); +@@ -424,7 +424,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_proplist_setf(m->input_proplist, "device.profile.pro", "true"); + pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); +- pa_proplist_set(m->input_proplist, "api.alsa.auto-link", "true"); ++ pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->input_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); +-- +GitLab + diff --git a/0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch b/0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch new file mode 100644 index 0000000..ce3313d --- /dev/null +++ b/0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch @@ -0,0 +1,85 @@ +From 945be16617dce4254b8a4793e9431d248b43b9c1 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 9 Oct 2023 10:35:30 +0200 +Subject: [PATCH] acp: only join and link when 1 capture and 1 playback + +Only schedule nodes together when there is just 1 capture and 1 playback +device. Devices might be mutually exclusive or require special setup +that would break otherwise. + +See #3556 +--- + spa/plugins/alsa/acp/acp.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c +index 1dbc0c2d7..e2e0b3eb5 100644 +--- a/spa/plugins/alsa/acp/acp.c ++++ b/spa/plugins/alsa/acp/acp.c +@@ -296,7 +296,7 @@ static const char *find_best_verb(pa_card *impl) + static int add_pro_profile(pa_card *impl, uint32_t index) + { + snd_ctl_t *ctl_hndl; +- int err, dev, count = 0; ++ int err, dev, count = 0, n_capture = 0, n_playback = 0; + pa_alsa_profile *ap; + pa_alsa_profile_set *ps = impl->profile_set; + pa_alsa_mapping *m; +@@ -304,6 +304,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + snd_pcm_info_t *pcminfo; + pa_sample_spec ss; + snd_pcm_uframes_t try_period_size, try_buffer_size; ++ uint32_t idx; + + if (impl->use_ucm) { + const char *verb = find_best_verb(impl); +@@ -388,12 +389,10 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_alsa_init_proplist_pcm(NULL, m->output_proplist, m->output_pcm); + pa_proplist_setf(m->output_proplist, "clock.name", "api.alsa.%u", index); + pa_proplist_setf(m->output_proplist, "device.profile.pro", "true"); +- pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); +- pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); +- pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->output_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); ++ n_playback++; + } + pa_idxset_put(ap->output_mappings, m, NULL); + free(name); +@@ -422,12 +421,10 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_alsa_init_proplist_pcm(NULL, m->input_proplist, m->input_pcm); + pa_proplist_setf(m->input_proplist, "clock.name", "api.alsa.%u", index); + pa_proplist_setf(m->input_proplist, "device.profile.pro", "true"); +- pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); +- pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); +- pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); + pa_alsa_close(&m->input_pcm); + m->supported = true; + pa_channel_map_init_auto(&m->channel_map, m->sample_spec.channels, PA_CHANNEL_MAP_AUX); ++ n_capture++; + } + pa_idxset_put(ap->input_mappings, m, NULL); + free(name); +@@ -435,6 +432,18 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + } + snd_ctl_close(ctl_hndl); + ++ if (n_capture == 1 && n_playback == 1) { ++ PA_IDXSET_FOREACH(m, ap->output_mappings, idx) { ++ pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); ++ pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); ++ pa_proplist_setf(m->output_proplist, "api.alsa.auto-link", "true"); ++ } ++ PA_IDXSET_FOREACH(m, ap->input_mappings, idx) { ++ pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); ++ pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); ++ pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); ++ } ++ } + return 0; + } + +-- +GitLab + diff --git a/0004-acp-only-disable-tsched-when-linking.patch b/0004-acp-only-disable-tsched-when-linking.patch new file mode 100644 index 0000000..14cd602 --- /dev/null +++ b/0004-acp-only-disable-tsched-when-linking.patch @@ -0,0 +1,47 @@ +From 2278dd1460e37fd011ca9b1101de478092fd1d74 Mon Sep 17 00:00:00 2001 +From: Wim Taymans +Date: Mon, 9 Oct 2023 12:28:10 +0200 +Subject: [PATCH] acp: only disable tsched when linking + +Disable timer based scheduling only if we are going to link the devices +together. + +See #3556 +--- + spa/plugins/alsa/acp/acp.c | 2 ++ + spa/plugins/alsa/alsa-pcm.c | 1 - + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c +index e2e0b3eb5..98f6326d1 100644 +--- a/spa/plugins/alsa/acp/acp.c ++++ b/spa/plugins/alsa/acp/acp.c +@@ -437,11 +437,13 @@ static int add_pro_profile(pa_card *impl, uint32_t index) + pa_proplist_setf(m->output_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->output_proplist, "node.link-group", "pro-audio-%u", index); + pa_proplist_setf(m->output_proplist, "api.alsa.auto-link", "true"); ++ pa_proplist_setf(m->output_proplist, "api.alsa.disable-tsched", "true"); + } + PA_IDXSET_FOREACH(m, ap->input_mappings, idx) { + pa_proplist_setf(m->input_proplist, "node.group", "pro-audio-%u", index); + pa_proplist_setf(m->input_proplist, "node.link-group", "pro-audio-%u", index); + pa_proplist_setf(m->input_proplist, "api.alsa.auto-link", "true"); ++ pa_proplist_setf(m->input_proplist, "api.alsa.disable-tsched", "true"); + } + } + return 0; +diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c +index 87dba34b0..ffcf4d5d0 100644 +--- a/spa/plugins/alsa/alsa-pcm.c ++++ b/spa/plugins/alsa/alsa-pcm.c +@@ -514,7 +514,6 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info) + + state->multi_rate = true; + state->htimestamp = false; +- state->disable_tsched = state->is_pro; + for (i = 0; info && i < info->n_items; i++) { + const char *k = info->items[i].key; + const char *s = info->items[i].value; +-- +GitLab + diff --git a/pipewire.changes b/pipewire.changes index d1fd11d..5bfa693 100644 --- a/pipewire.changes +++ b/pipewire.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Oct 13 08:33:28 UTC 2023 - Antonio Larrosa + +- Add patches from upstream that fix pro-audio not producing any + sound in 0.3.81: + * 0001-alsa-add-api.alsa.auto-link-option.patch + * 0002-acp-fix-compilation.patch + * 0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch + * 0004-acp-only-disable-tsched-when-linking.patch + ------------------------------------------------------------------- Mon Oct 9 11:34:40 UTC 2023 - Antonio Larrosa diff --git a/pipewire.spec b/pipewire.spec index fb21090..3f3c7af 100644 --- a/pipewire.spec +++ b/pipewire.spec @@ -70,6 +70,14 @@ Source0: %{name}-%{version}.tar.xz Source99: baselibs.conf # PATCH-FIX-OPENSUSE reduce-meson-dependency.patch Patch0: reduce-meson-dependency.patch +# PATCH-FIX-UPSTREAM 0001-alsa-add-api.alsa.auto-link-option.patch +Patch1: 0001-alsa-add-api.alsa.auto-link-option.patch +# PATCH-FIX-UPSTREAM 0002-acp-fix-compilation.patch +Patch2: 0002-acp-fix-compilation.patch +# PATCH-FIX-UPSTREAM 0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch +Patch3: 0003-acp-only-join-and-link-when-1-capture-and-1-playback.patch +# PATCH-FIX-UPSTREAM 0004-acp-only-disable-tsched-when-linking.patch +Patch4: 0004-acp-only-disable-tsched-when-linking.patch BuildRequires: docutils BuildRequires: doxygen @@ -383,6 +391,10 @@ JACK libraries. sed -ie "s/version : '0.3.72'/version : '%{version}'/" %{P:0} %patch0 -p1 %endif +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build %if %{pkg_vcmp gcc < 8}