pcm_mixer: fix active_channels handling in mixer_handle_sampr_change
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 23 Jul 2026 21:17:14 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 8d84986fc086503a021d5f6d4b1e21f39b22db5d Author: Roman Artiukhin <[email protected]> Date: Tue Jun 9 18:37:54 2026 +0300 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 diff --git a/firmware/pcm_mixer.c b/firmware/pcm_mixer.c index 5de15ac793..7c17255990 100644 --- a/firmware/pcm_mixer.c +++ b/firmware/pcm_mixer.c @@ -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) { -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs