pulse-server: don't fix sample rate

Use the builder directly to leave the samplerate undefined so that we
adapt to the graph samplerate instead of forcing resampling.
This commit is contained in:
Wim Taymans 2021-04-01 09:32:00 +02:00
parent 4aa817771a
commit 27e00d1be4

View file

@ -150,8 +150,14 @@ static int module_loopback_load(struct client *client, struct module *module)
&out_stream_events, data);
n_params = 0;
params[n_params++] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat,
&data->info);
params[n_params++] = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_audio),
SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
SPA_FORMAT_AUDIO_format, SPA_POD_Id(data->info.format),
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(data->info.channels),
SPA_FORMAT_AUDIO_position, SPA_POD_Array(sizeof(uint32_t),
SPA_TYPE_Id, data->info.channels, data->info.position));
if ((res = pw_stream_connect(data->capture,
PW_DIRECTION_INPUT,
@ -236,21 +242,7 @@ static struct module *create_module_loopback(struct impl *impl, const char *argu
pw_properties_set(props, "sink", NULL);
}
if ((str = pw_properties_get(props, "format")) != NULL) {
info.format = format_paname2id(str, strlen(str));
if (info.format == SPA_AUDIO_FORMAT_UNKNOWN)
ERROR_RETURN("Unknown format specified");
pw_properties_set(props, "format", NULL);
} else {
info.format = SPA_AUDIO_FORMAT_F32P;
}
if ((str = pw_properties_get(props, "rate")) != NULL) {
info.rate = pw_properties_parse_int(str);
pw_properties_set(props, "rate", NULL);
} else {
info.rate = 48000;
}
if ((str = pw_properties_get(props, "channels")) != NULL) {
info.channels = pw_properties_parse_int(str);