alsa: guard agaist NULL areas

snd_pcm_ioplug_mmap_areas() can fail and return NULL

Fixes #3600
This commit is contained in:
Wim Taymans 2023-10-22 17:26:25 +02:00
parent 7fa64a8b71
commit 920beea3eb

View file

@ -309,8 +309,8 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b,
xfer = nframes;
if (xfer > 0) {
const snd_pcm_channel_area_t *areas = snd_pcm_ioplug_mmap_areas(io);
if (areas != NULL) {
const snd_pcm_uframes_t offset = hw_ptr % io->buffer_size;
if (io->stream == SND_PCM_STREAM_PLAYBACK)
snd_pcm_areas_copy_wrap(pwareas, 0, nframes,
areas, offset,
@ -323,7 +323,7 @@ snd_pcm_pipewire_process(snd_pcm_pipewire_t *pw, struct pw_buffer *b,
pwareas, 0, nframes,
io->channels, xfer,
io->format);
}
hw_ptr += xfer;
if (hw_ptr >= pw->boundary)
hw_ptr -= pw->boundary;