pcm_mixer: fix active_channels handling in mixer_handle_sampr_change

`channel_stopped` compacts the `active_channels` array, so we should check the same index for the next active channel.

Change-Id: I54c42f9b6c97f0c54d43b8faae0052e856f3c06d
This commit is contained in:
Roman Artiukhin 2026-06-09 18:37:54 +03:00 • committed by Solomon Peachy
parent 958e84c042
commit 8d84986fc0

View file

@ -288,10 +288,11 @@ static void mixer_start_pcm(void)
/* Notify users of samplerate change */
static void mixer_handle_sampr_change(unsigned int sampr)
{
for (size_t i = 0; i < ARRAYLEN(active_channels) && active_channels[i]; i += 1)
int i = 0;
struct mixer_channel* chan;
while ((chan = active_channels[i]))
{
struct mixer_channel* chan = active_channels[i];
bool stop_channel = true;
/* Notify upstreams */
if (chan->play_cbs)
{
@ -309,13 +310,19 @@ static void mixer_handle_sampr_change(unsigned int sampr)
chan->start = start;
chan->size = size;
chan->last_size = 0;
} else {
channel_stopped(chan);
stop_channel = false;
++i;
}
}
}
if (stop_channel)
{
channel_stopped(chan);
}
/* Notify buffer monitor */
if (chan->buf_cbs)
else if (chan->buf_cbs)
{
if (chan->buf_cbs->sampr_changed)
{