[PATCH] ALSA: usb-audio: Increase max buffer size
Takashi Iwai
tiwai at suse.de
Sun Apr 10 09:40:10 CEST 2022
On Sat, 09 Apr 2022 22:43:13 +0200,
Jaroslav Kysela wrote:
>
> On 09. 04. 22 22:36, Geraldo Nascimento wrote:
> > On Thu, Apr 07, 2022 at 11:27:40PM +0200, Takashi Iwai wrote:
> >> The current limit of max buffer size 1MB seems too small for modern
> >> devices with lots of channels and high sample rates.
> >> Let's make bigger, 4MB.
> >
> > Hi Takashi,
> >
> > I did some math and 4MB is still too little for some extreme hardware
> > like the Behringer Wing, which is USB 2.0 by the way. According to my
> > calculations, at 192 KHz and 48 channels, even with this 4MB patch, we
> > would still have only 151.7 ms of buffer for the Wing.
> >
> > Therefore my suggestion is to expose the MAX_BUFFER_BYTES as Kconf.
> >
> > Do you think this is plausible?
>
> I think that much better behaviour may be to calculate and limit the
> max buffer size at runtime depending on the max channels / rate /
> sample bits obtained from the USB descriptors by default. For standard
> hardware, those big buffers do not make much sense and there's usually
> a mix of the USB sound hardware in the system.
IMO, one good way would be to leave buffer and period bytes max
unlimited, while limiting buffer and period max time instead. It
should cover all combinations. But involving the buffer/period time
may have some alignment issue with bytes and frame sizes, so we need
to check whether it works reliably (although I believe it'd work in
that case).
My concern by removing the limit is, however, the behavior change in
certain applications. It can't be known until we really hit the
issue, though. Let's see.
thanks,
Takashi
More information about the Alsa-devel
mailing list