This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 975ab1d9aa0187f71417945655956a4c2481041f Author: fangyibo <[email protected]> AuthorDate: Tue Aug 4 14:08:29 2026 +0800 audio: limit the buffer count guard to shared ring requests The upper->periods >= upper->nbuffers check sat at the top of audio_allocbuffer(), but upper->periods is only incremented for shared ring requests (u.pbuffer == NULL), so for private buffer callers the check degenerated into "nbuffers == 0" and rejected every allocation when the lower half does not implement AUDIOIOC_GETBUFFERINFO, which is the only place nbuffers is ever assigned. Move the guard inside the shared ring branch so private buffers, which never enter upper->apbs[] and are unrelated to the ring depth, stay allocatable. The zero return value is kept as-is because a second application attaching to the same device relies on it to skip allocation and go straight to AUDIOIOC_ENQUEUEBUFFER. Signed-off-by: fangyibo <[email protected]> --- audio/audio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 8ae1a1764c9..74229873b59 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -769,13 +769,13 @@ static int audio_allocbuffer(FAR struct audio_upperhalf_s *upper, FAR void *newaddr; int ret; - if (upper->periods >= upper->nbuffers) - { - return 0; - } - if (bufdesc->u.pbuffer == NULL) { + if (upper->periods >= upper->nbuffers) + { + return 0; + } + bufdesc->u.pbuffer = &apb; share = true; }
