Write buffer size max over p.

2026年7月6日(月) 22:43 yesreal <[email protected]>:

> Hopefully
>
> 2026年7月6日(月) 21:14 Christos Margiolis <[email protected]>:
>
>> On Mon Jul 6, 2026 at 12:15 AM EEST, Kevin Bowling wrote:
>> > Hi,
>> >
>> > I am working on a more complete pipewire audio sink
>> > (audio/pipewire-spa-oss-ng) and ran into an interesting case where a
>> > user has an interface with 10 channels on one dsp device.
>> >
>> > In sys/dev/sound/pcm/channel.h we currently have:
>> > #define CHN_2NDBUFMAXSIZE 131072
>> >
>> > This is workable but results in a tighter bound than my sink requests.
>> >
>> > I am wondering if we should dynamically scale, something like this:
>> >
>> >  #define CHN_2NDBUFMAXSIZE_DEFAULT 131072
>> >  #define CHN_2NDBUFMAXSIZE_LIMIT   1048576
>> >
>> >  static uint32_t
>> >  chn_2ndbuf_maxsize(struct pcm_channel *c)
>> >  {
>> >          struct snd_dbuf *bs = c->bufsoft;
>> >          uint64_t bytes;
>> >
>> >          /* e.g. allow up to about 100 ms of the actual stream. */
>> >          bytes = (uint64_t)bs->align * bs->spd / 10;
>> >
>> >          if (bytes < CHN_2NDBUFMAXSIZE_DEFAULT)
>> >                  bytes = CHN_2NDBUFMAXSIZE_DEFAULT;
>> >          if (bytes > chn_2ndbuf_maxsize_limit)
>> >                  bytes = chn_2ndbuf_maxsize_limit;
>> >
>> >          return (uint32_t)bytes;
>> >  }
>> >
>> > I can send a complete patch for review if it seems like a reasonable
>> direction.
>> >
>> > Regards,
>> > Kevin Bowling
>>
>> Feel free to propose the patch and add me as a reviewer, I was actually
>> meaning to either remove this or refactor this. Thank you!
>>
>> Christos
>>
>>

Reply via email to