Increase audio buffer size for I2S

I have a high bit rate stream being received through I2S and get the occasional overrun so I would like to increase the buffer size.

L4T docs say to edit the tegra_alt_pcm_hardware struct in
kernel/nvidia/sound/soc/tegra-alt/utils/tegra_pcm_alt.c

static const struct snd_pcm_hardware tegra_alt_pcm_hardware = {
	.info			= SNDRV_PCM_INFO_MMAP |
				  SNDRV_PCM_INFO_MMAP_VALID |
				  SNDRV_PCM_INFO_PAUSE |
				  SNDRV_PCM_INFO_RESUME |
				  SNDRV_PCM_INFO_INTERLEAVED,
	.formats		= SNDRV_PCM_FMTBIT_S8 |
				  SNDRV_PCM_FMTBIT_S16_LE |
				  SNDRV_PCM_FMTBIT_S24_LE |
				  SNDRV_PCM_FMTBIT_S20_3LE |
				  SNDRV_PCM_FMTBIT_S32_LE,
	.period_bytes_min	= 128,
	.period_bytes_max	= PAGE_SIZE * 4,
	.periods_min		= 1,
	.periods_max		= 8,
	.buffer_bytes_max	= PAGE_SIZE * 8,
	.fifo_size		= 4,
};

to just increase the value of buffer_bytes_max
should I also proportionally increase period_bytes_max or any other values such as in this post?

Also is there a limit to what the buffer size can be?

Thanks

Hi cores4days

Generally period_bytes_max is half of buffer_bytes_max. You can keep it that way.

Also I suggest to try out other recommendations, related to CPU clocks/performance and RAM disk usage, from the reference post.

Also for experimenting, you can try with a lower bit rate to see if the overruns still happen.

Thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.