mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pulse: use the EnumFormat param to set reasonable defaults
Before the node is started, we don't get a Format parameters and we don't know the channelmap of the node. This forces us to invent a channelmap that might be wrong. We can do better by using the EnumFormat param to extract some defaults for the format, rate and channelmap. Fixes wrong channels in gnome-control-center when testing speakers.
This commit is contained in:
parent
644a35a559
commit
1e6615f79d
1 changed files with 13 additions and 1 deletions
|
|
@ -1002,8 +1002,20 @@ static void node_event_param(void *object, int seq,
|
||||||
case SPA_PARAM_EnumFormat:
|
case SPA_PARAM_EnumFormat:
|
||||||
{
|
{
|
||||||
pa_format_info *f = pa_format_info_from_param(param);
|
pa_format_info *f = pa_format_info_from_param(param);
|
||||||
if (f)
|
if (f) {
|
||||||
pw_array_add_ptr(&g->node_info.formats, f);
|
pw_array_add_ptr(&g->node_info.formats, f);
|
||||||
|
|
||||||
|
if (g->node_info.channel_map.channels == 0)
|
||||||
|
pa_format_info_get_channel_map(f, &g->node_info.channel_map);
|
||||||
|
|
||||||
|
if (g->node_info.sample_spec.format == 0 ||
|
||||||
|
g->node_info.sample_spec.rate == 0 ||
|
||||||
|
g->node_info.sample_spec.channels == 0) {
|
||||||
|
pa_format_info_get_sample_format(f, &g->node_info.sample_spec.format);
|
||||||
|
pa_format_info_get_rate(f, &g->node_info.sample_spec.rate);
|
||||||
|
pa_format_info_get_channels(f, &g->node_info.sample_spec.channels);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPA_PARAM_Format:
|
case SPA_PARAM_Format:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue