meta-agl-core: remove IMAGE_FSTYPES override
[AGL/meta-agl.git] / meta-pipewire / recipes-multimedia / pipewire / pipewire / 0007-alsa-Set-period_size-depending-on-hardware.patch
1 From bbf9c767d5b353142e03080762bdd805e124d50b Mon Sep 17 00:00:00 2001
2 From: Walter Lozano <walter.lozano@collabora.com>
3 Date: Fri, 7 Aug 2020 10:58:29 -0300
4 Subject: [PATCH] alsa: Set period_size depending on hardware
5
6 Currently PipeWire is unable to reproduce audio in systems where DMA
7 granularity is not burst.
8
9 In order to mitigate this issue, set period_size depending on hardware,
10 lowering it when snd_pcm_hw_params_is_batch == 1, to reduce DMA
11 transfers size.
12
13 Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
14 ---
15  spa/plugins/alsa/alsa-pcm.c | 4 ++++
16  1 file changed, 4 insertions(+)
17
18 diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
19 index 63d75549..2d3850b7 100644
20 --- a/spa/plugins/alsa/alsa-pcm.c
21 +++ b/spa/plugins/alsa/alsa-pcm.c
22 @@ -463,6 +463,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
23  
24         dir = 0;
25         period_size = 1024;
26 +       if (snd_pcm_hw_params_is_batch(params)) {
27 +               period_size = 512;
28 +               spa_log_warn(state->log, NAME" hardware does double buffering, changing period_size to %ld", period_size);
29 +       }
30         CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near");
31         CHECK(snd_pcm_hw_params_get_buffer_size_max(params, &state->buffer_frames), "get_buffer_size_max");
32         CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");
33 -- 
34 2.20.1
35