[PATCH] ALSA: pcm: fix buffer_bytes max constrained by preallocated bytes issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With today's code, we preallocate DMA buffer for substreams at pcm_new()
stage, and the substream->buffer_bytes_max and substream->dma_max will
save as the actually preallocated buffer size and maximum size that the
dma buffer can be expanded by at hw_params() state, correspondingly.

At pcm_open() stage, the maximum constraint of HW_PARAM_BUFFER_BYTES is
set to substream->buffer_bytes_max and returned to user space as the max
interval of the HW_PARAM_BUFFER_BYTES, this will lead to issue that user
can't choose any buffer-bytes larger than the preallocated buffer size,
and the buffer reallocation will never happen actually.

Here change to use substream->dma_max as the maximum constraint of the
HW_PARAM_BUFFER_BYTES and fix the issue mentioned above.

Signed-off-by: Keyon Jie <yang.jie@xxxxxxxxxxxxxxx>
---
 sound/core/pcm_native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index c375c41496f8..326e921006e7 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -2301,7 +2301,7 @@ static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params,
 	struct snd_interval t;
 	struct snd_pcm_substream *substream = rule->private;
 	t.min = 0;
-	t.max = substream->buffer_bytes_max;
+	t.max = substream->dma_max;
 	t.openmin = 0;
 	t.openmax = 0;
 	t.integer = 1;
-- 
2.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux