stream: only set portconfig on audio formats

This commit is contained in:
Wim Taymans 2019-12-17 17:35:46 +01:00
parent e9b62c0ce6
commit cc0be0d606

View file

@ -136,22 +136,34 @@ static int stream_set_active(struct stream *stream, bool active)
if (active) { if (active) {
stream->format = node->format; stream->format = node->format;
stream->format.info.raw.rate = 48000;
spa_pod_builder_init(&b, buf, sizeof(buf)); switch (stream->format.media_type) {
param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &stream->format.info.raw); case SPA_MEDIA_TYPE_audio:
param = spa_pod_builder_add_object(&b, switch (stream->format.media_subtype) {
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig, case SPA_MEDIA_SUBTYPE_raw:
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(endpoint->info.direction), stream->format.info.raw.rate = 48000;
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(false),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG)) spa_pod_builder_init(&b, buf, sizeof(buf));
spa_debug_pod(2, NULL, param); param = spa_format_audio_raw_build(&b, SPA_PARAM_Format, &stream->format.info.raw);
param = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamPortConfig, SPA_PARAM_PortConfig,
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(endpoint->info.direction),
SPA_PARAM_PORT_CONFIG_mode, SPA_POD_Id(SPA_PARAM_PORT_CONFIG_MODE_dsp),
SPA_PARAM_PORT_CONFIG_monitor, SPA_POD_Bool(false),
SPA_PARAM_PORT_CONFIG_format, SPA_POD_Pod(param));
pw_node_set_param((struct pw_node*)node->obj->obj.proxy, if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
SPA_PARAM_PortConfig, 0, param); spa_debug_pod(2, NULL, param);
pw_node_set_param((struct pw_node*)node->obj->obj.proxy,
SPA_PARAM_PortConfig, 0, param);
break;
default:
break;
}
default:
break;
}
} }
stream->active = active; stream->active = active;
return 0; return 0;