Add patch to fix sound in qemu.

This commit is contained in:
Wim Taymans 2022-11-17 10:35:59 +01:00
parent b86bf4c0f6
commit 7e4b6aae7b
5 changed files with 85 additions and 3 deletions

View File

@ -1,7 +1,7 @@
From 0c9dd45914452a7676e0cea2c10a0d7ad5bbaf32 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Thu, 10 Nov 2022 16:13:33 +0100
Subject: [PATCH 1/2] pulse-server: also advance read pointer in underrun
Subject: [PATCH 1/4] pulse-server: also advance read pointer in underrun
So that we ask for more data from the client.

View File

@ -1,7 +1,7 @@
From 3d5142fa504623f6084d2938c69678256d6c2ff3 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Tue, 15 Nov 2022 15:40:47 +0100
Subject: [PATCH 2/2] audioadapter: perform setup again after a PortConfig
Subject: [PATCH 2/4] audioadapter: perform setup again after a PortConfig
After the ports are reconfigured, we need to perform the setup again so
that buffers and processing can happen with the right settings.

View File

@ -0,0 +1,47 @@
From 197c120eb990dd48afbe8f04505f18a5b5a70457 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Tue, 15 Nov 2022 16:30:26 +0100
Subject: [PATCH 3/4] acp: do probing in 44100 Hz again
Some devices don't seem to work when probed in 48000 so bring it back
to 44100 until we figure out what is going on.
Fixes #2718
---
spa/plugins/alsa/acp/acp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/spa/plugins/alsa/acp/acp.c b/spa/plugins/alsa/acp/acp.c
index c49c9e088..4bbe5ee92 100644
--- a/spa/plugins/alsa/acp/acp.c
+++ b/spa/plugins/alsa/acp/acp.c
@@ -34,6 +34,8 @@ void *_acp_log_data;
struct spa_i18n *acp_i18n;
+#define DEFAULT_RATE 44100
+
#define VOLUME_ACCURACY (PA_VOLUME_NORM/100) /* don't require volume adjustments to be perfectly correct. don't necessarily extend granularity in software unless the differences get greater than this level */
static const uint32_t channel_table[PA_CHANNEL_POSITION_MAX] = {
@@ -312,7 +314,7 @@ static int add_pro_profile(pa_card *impl, uint32_t index)
snd_pcm_uframes_t try_period_size, try_buffer_size;
ss.format = PA_SAMPLE_S32LE;
- ss.rate = 48000;
+ ss.rate = DEFAULT_RATE;
ss.channels = 64;
ap = pa_xnew0(pa_alsa_profile, 1);
@@ -1571,7 +1573,7 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
}
impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE;
- impl->ucm.default_sample_spec.rate = 48000;
+ impl->ucm.default_sample_spec.rate = DEFAULT_RATE;
impl->ucm.default_sample_spec.channels = 2;
pa_channel_map_init_extend(&impl->ucm.default_channel_map,
impl->ucm.default_sample_spec.channels, PA_CHANNEL_MAP_ALSA);
--
2.38.1

View File

@ -0,0 +1,30 @@
From aa4e2cce42a049b00ef4b63547a87422da109905 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 16 Nov 2022 20:45:38 +0100
Subject: [PATCH 4/4] alsa: force playback start when buffer is full
When we try to play data but the ringbuffer is full, we need to start
the device or else we will stay in this situation forever and stay
silent.
Fixes #2830
---
spa/plugins/alsa/alsa-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
index fed56e7bb..5e0a60b37 100644
--- a/spa/plugins/alsa/alsa-pcm.c
+++ b/spa/plugins/alsa/alsa-pcm.c
@@ -2128,7 +2128,7 @@ again:
state->sample_count += total_written;
- if (SPA_UNLIKELY(!state->alsa_started && total_written > 0))
+ if (SPA_UNLIKELY(!state->alsa_started && (total_written > 0 || frames == 0)))
do_start(state);
return 0;
--
2.38.1

View File

@ -9,7 +9,7 @@
%global ms_version 0.4.1
# For rpmdev-bumpspec and releng automation
%global baserelease 4
%global baserelease 5
#global snapdate 20210107
#global gitcommit b17db2cebc1a5ab2c01851d29c05f79cd2f262bb
@ -75,6 +75,8 @@ Source1: https://gitlab.freedesktop.org/pipewire/media-session/-/archive/
## upstream patches
Patch0001: 0001-pulse-server-also-advance-read-pointer-in-underrun.patch
Patch0002: 0002-audioadapter-perform-setup-again-after-a-PortConfig.patch
Patch0003: 0003-acp-do-probing-in-44100-Hz-again.patch
Patch0004: 0004-alsa-force-playback-start-when-buffer-is-full.patch
## upstreamable patches
@ -618,6 +620,9 @@ systemctl --no-reload preset --global pipewire.socket >/dev/null 2>&1 || :
%endif
%changelog
* Thu Nov 17 2022 Wim Taymans <wtaymans@redhat.com> - 0.3.60-5
- Add patch to fix sound in qemu.
* Tue Nov 15 2022 Wim Taymans <wtaymans@redhat.com> - 0.3.60-4
- Add patch to avoid crashes when switching profiles