mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: fix IEC958 passthrough again
We need to create fake channels when parsing the IEC958 format or else we get an invalid format and IEC958 passthrough doesn't work. Ignore the IEC958 formats when collecting formats for the device or else the fake channels mess with the real channels of the device. See #1442
This commit is contained in:
parent
22ec01d5c0
commit
edb5664017
4 changed files with 12 additions and 5 deletions
|
|
@ -279,13 +279,13 @@ void collect_device_info(struct pw_manager_object *device, struct pw_manager_obj
|
|||
{
|
||||
struct spa_pod *copy = spa_pod_copy(p->param);
|
||||
spa_pod_fixate(copy);
|
||||
format_parse_param(copy, &dev_info->ss, &dev_info->map,
|
||||
format_parse_param(copy, true, &dev_info->ss, &dev_info->map,
|
||||
&defs->sample_spec, &defs->channel_map);
|
||||
free(copy);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Format:
|
||||
format_parse_param(p->param, &dev_info->ss, &dev_info->map,
|
||||
format_parse_param(p->param, true, &dev_info->ss, &dev_info->map,
|
||||
NULL, NULL);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -443,7 +443,8 @@ audio_raw_parse_opt(const struct spa_pod *format, struct spa_audio_info_raw *inf
|
|||
return res;
|
||||
}
|
||||
|
||||
int format_parse_param(const struct spa_pod *param, struct sample_spec *ss, struct channel_map *map,
|
||||
int format_parse_param(const struct spa_pod *param, bool collect,
|
||||
struct sample_spec *ss, struct channel_map *map,
|
||||
const struct sample_spec *def_ss, const struct channel_map *def_map)
|
||||
{
|
||||
struct spa_audio_info info = { 0 };
|
||||
|
|
@ -471,11 +472,17 @@ int format_parse_param(const struct spa_pod *param, struct sample_spec *ss, stru
|
|||
{
|
||||
struct spa_audio_info_iec958 iec;
|
||||
|
||||
if (collect)
|
||||
break;
|
||||
|
||||
if (spa_format_audio_iec958_parse(param, &iec) < 0)
|
||||
return -ENOTSUP;
|
||||
|
||||
info.info.raw.format = SPA_AUDIO_FORMAT_S16;
|
||||
info.info.raw.rate = iec.rate;
|
||||
info.info.raw.channels = 2;
|
||||
info.info.raw.position[0] = SPA_AUDIO_CHANNEL_FL;
|
||||
info.info.raw.position[1] = SPA_AUDIO_CHANNEL_FR;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ void channel_map_to_positions(const struct channel_map *map, uint32_t *pos);
|
|||
void channel_map_parse(const char *str, struct channel_map *map);
|
||||
bool channel_map_valid(const struct channel_map *map);
|
||||
|
||||
int format_parse_param(const struct spa_pod *param, struct sample_spec *ss,
|
||||
int format_parse_param(const struct spa_pod *param, bool collect, struct sample_spec *ss,
|
||||
struct channel_map *map, const struct sample_spec *def_ss,
|
||||
const struct channel_map *def_map);
|
||||
|
||||
|
|
|
|||
|
|
@ -1062,7 +1062,7 @@ static void stream_param_changed(void *data, uint32_t id, const struct spa_pod *
|
|||
if (id != SPA_PARAM_Format || param == NULL)
|
||||
return;
|
||||
|
||||
if ((res = format_parse_param(param, &stream->ss, &stream->map, NULL, NULL)) < 0) {
|
||||
if ((res = format_parse_param(param, false, &stream->ss, &stream->map, NULL, NULL)) < 0) {
|
||||
pw_stream_set_error(stream->stream, res, "format not supported");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue