mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
alsa: handle driver bugs better
Use the NEAREST flag when setting a format. This only works for raw formats and will update the format with the nearest accepted rate or channels. We can then query the real configured format and use that for the converter. This makes things work when a driver tells us it can do 44100Hz but then refuses and changes the rate to 48000. See #2197, #2457, #2455, rhbz#2096193
This commit is contained in:
parent
ecc0eecf0f
commit
0f62d3442c
4 changed files with 35 additions and 12 deletions
|
|
@ -1409,7 +1409,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
state->props.device, rchannels, val);
|
||||
if (!SPA_FLAG_IS_SET(flags, SPA_NODE_PARAM_FLAG_NEAREST))
|
||||
return -EINVAL;
|
||||
if (fmt->media_subtype != SPA_MEDIA_SUBTYPE_raw)
|
||||
return -EINVAL;
|
||||
rchannels = val;
|
||||
fmt->info.raw.channels = rchannels;
|
||||
match = false;
|
||||
}
|
||||
|
||||
|
|
@ -1429,7 +1432,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
|
|||
state->props.device, rrate, val);
|
||||
if (!SPA_FLAG_IS_SET(flags, SPA_NODE_PARAM_FLAG_NEAREST))
|
||||
return -EINVAL;
|
||||
if (fmt->media_subtype != SPA_MEDIA_SUBTYPE_raw)
|
||||
return -EINVAL;
|
||||
rrate = val;
|
||||
fmt->info.raw.rate = rrate;
|
||||
match = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue