pcm_meter: let the s16 scope degrade instead of killing the caller
s16_enable() returns -EINVAL for any format it cannot convert to S16 -
DSD, the 3-byte packed formats, float. snd_pcm_scope_enable() records
that as "not enabled" and carries on, so the buffer is never allocated.
Any other scope stays enabled, though, and scopes reach the s16 buffer
through snd_pcm_scope_s16_get_channel_buffer(), which asserts on exactly
that never-allocated pointer. The application dies. Our own level scope
does this, so alsa-lib kills its own caller; the same happens to
libpeppyalsa, where a DSD track aborts the music player mid-playback.
Allocate the buffer anyway and leave it zero, so a scope reads silence on
a format the s16 conversion cannot see. Callers need no change and none
can be made to abort. The condition is reported once through SNDERR
rather than being swallowed.
The neighbouring S16/MMAP_NONINTERLEAVED branch returns -EINVAL after
assigning s16->buf and reaches the same dead end; it is left alone here
because its intent is unclear. Signed-off-by: Julien Gainza <gainza.julien@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Closes: https://github.com/alsa-project/alsa-lib/pull/516 Signed-off-by: Jaroslav Kysela <perex@perex.cz>