diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index 70d81d1be..85bcccbde 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -1182,6 +1182,7 @@ struct impl { struct pw_properties *control_props; struct pw_stream *control; struct spa_hook control_listener; + bool control_stream_active; struct spa_audio_info_raw info; @@ -1669,33 +1670,35 @@ static int setup_streams(struct impl *impl) struct spa_pod_dynamic_builder b; struct spa_filter_graph *graph = impl->graph; - impl->control = pw_stream_new(impl->core, - "filter control", impl->control_props); - impl->control_props = NULL; - if (impl->control == NULL) - return -errno; + if (impl->control_stream_active) { + impl->control = pw_stream_new(impl->core, + "filter control", impl->control_props); + impl->control_props = NULL; + if (impl->control == NULL) + return -errno; - pw_stream_add_listener(impl->control, - &impl->control_listener, - &control_stream_events, impl); + pw_stream_add_listener(impl->control, + &impl->control_listener, + &control_stream_events, impl); - uint8_t buffer[256]; - struct spa_pod_builder bt = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); - const struct spa_pod *param[1]; + uint8_t buffer[256]; + struct spa_pod_builder bt = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); + const struct spa_pod *param[1]; - param[0] = spa_pod_builder_add_object(&bt, - SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, - SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), - SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control) - ); + param[0] = spa_pod_builder_add_object(&bt, + SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat, + SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_application), + SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_control) + ); - pw_stream_connect(impl->control, - PW_DIRECTION_INPUT, - PW_ID_ANY, - PW_STREAM_FLAG_AUTOCONNECT | - PW_STREAM_FLAG_MAP_BUFFERS | - PW_STREAM_FLAG_RT_PROCESS, - param, 1); + pw_stream_connect(impl->control, + PW_DIRECTION_INPUT, + PW_ID_ANY, + PW_STREAM_FLAG_AUTOCONNECT | + PW_STREAM_FLAG_MAP_BUFFERS | + PW_STREAM_FLAG_RT_PROCESS, + param, 1); + } impl->capture = pw_stream_new(impl->core, "filter capture", impl->capture_props); @@ -2119,7 +2122,17 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) &impl->core_listener, &core_events, impl); - setup_streams(impl); + if (pw_properties_get(props, "controlStream.enabled") == NULL) { + impl->control_stream_active = false; + } else if (strcmp(pw_properties_get(props, "controlStream.enabled"), "true") + == 0) { + impl->control_stream_active = true; + } else if (strcmp(pw_properties_get(props, "controlStream.enabled"), "false") + == 0) { + impl->control_stream_active = false; + } + + setup_streams(impl); pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);