mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa-pcm: handle and warn about a driver bug wrt channels
If the driver returns a larger min than max channel count, log a warning and swap the two numbers. See #4687
This commit is contained in:
parent
d5e2cc94cd
commit
b2695f86cf
1 changed files with 6 additions and 0 deletions
|
|
@ -1563,6 +1563,12 @@ static int add_channels(struct state *state, bool all, uint32_t index, uint32_t
|
|||
spa_log_debug(state->log, "channels (%d %d) default:%d all:%d",
|
||||
min, max, state->default_channels, all);
|
||||
|
||||
if (min > max) {
|
||||
spa_log_warn(state->log, "driver bug! min > max channels: (%d > %d)",
|
||||
min, max);
|
||||
SPA_SWAP(min, max);
|
||||
}
|
||||
|
||||
if (state->default_channels != 0 && !all) {
|
||||
if (min < state->default_channels)
|
||||
min = state->default_channels;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue