pulse-server: put the channel map in the loopback args

Fixes #1486
This commit is contained in:
Wim Taymans 2021-09-21 18:33:29 +02:00
parent 59203c11b8
commit 6f519d4052
2 changed files with 14 additions and 2 deletions

View file

@ -174,6 +174,7 @@ int module_args_to_audioinfo(struct impl *impl, struct pw_properties *props, str
/* We don't use any incoming format setting and use our native format */
spa_zero(*info);
info->flags = SPA_AUDIO_FLAG_UNPOSITIONED;
info->format = SPA_AUDIO_FORMAT_F32P;
if ((str = pw_properties_get(props, "channels")) != NULL) {
@ -199,6 +200,7 @@ int module_args_to_audioinfo(struct impl *impl, struct pw_properties *props, str
return -EINVAL;
}
channel_map_to_positions(&map, info->position);
info->flags &= ~SPA_AUDIO_FLAG_UNPOSITIONED;
pw_properties_set(props, "channel_map", NULL);
} else {
if (info->channels == 0)
@ -216,6 +218,8 @@ int module_args_to_audioinfo(struct impl *impl, struct pw_properties *props, str
for (i = 0; i < info->channels; i++)
info->position[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
}
if (info->position[0] != SPA_AUDIO_CHANNEL_UNKNOWN)
info->flags &= ~SPA_AUDIO_FLAG_UNPOSITIONED;
}
if ((str = pw_properties_get(props, "rate")) != NULL) {

View file

@ -63,15 +63,23 @@ static int module_loopback_load(struct client *client, struct module *module)
struct module_loopback_data *data = module->user_data;
FILE *f;
char *args;
size_t size;
size_t size, i;
pw_properties_setf(data->capture_props, PW_KEY_NODE_GROUP, "loopback-%u", module->idx);
pw_properties_setf(data->playback_props, PW_KEY_NODE_GROUP, "loopback-%u", module->idx);
f = open_memstream(&args, &size);
fprintf(f, "{");
if (data->info.channels != 0)
if (data->info.channels != 0) {
fprintf(f, " audio.channels = %u", data->info.channels);
if (!(data->info.flags & SPA_AUDIO_FLAG_UNPOSITIONED)) {
fprintf(f, " audio.position = [ ");
for (i = 0; i < data->info.channels; i++)
fprintf(f, "%s%s", i == 0 ? "" : ",",
channel_id2name(data->info.position[i]));
fprintf(f, " ]");
}
}
fprintf(f, " capture.props = {");
pw_properties_serialize_dict(f, &data->capture_props->dict, 0);
fprintf(f, " } playback.props = {");