diff --git a/src/modules/module-protocol-pulse/collect.c b/src/modules/module-protocol-pulse/collect.c index fe28fae3b..36f46efdb 100644 --- a/src/modules/module-protocol-pulse/collect.c +++ b/src/modules/module-protocol-pulse/collect.c @@ -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; diff --git a/src/modules/module-protocol-pulse/format.c b/src/modules/module-protocol-pulse/format.c index 75acf9c99..f680e55d3 100644 --- a/src/modules/module-protocol-pulse/format.c +++ b/src/modules/module-protocol-pulse/format.c @@ -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: diff --git a/src/modules/module-protocol-pulse/format.h b/src/modules/module-protocol-pulse/format.h index 7f9cf4c93..4300fc08a 100644 --- a/src/modules/module-protocol-pulse/format.h +++ b/src/modules/module-protocol-pulse/format.h @@ -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); diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index e4e77faad..80ec7c93a 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -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; }