From 6115a240d1b486ed5e208541e10b570ffc87134c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 21 May 2025 15:23:00 +0200 Subject: [PATCH] filter-chain: manage graph from source only Only react to the capture stream state change and format changes. The playback and capture streams change state somewhat concurrently and so the graph state might not be consistent. Because only the capture stream will trigger the playback stream and start the processing, we can safely react to capture stream changes only. --- src/modules/module-filter-chain.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index 537b8c7d0..50075a779 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -972,7 +972,7 @@ static void param_tag_changed(struct impl *impl, const struct spa_pod *param) pw_stream_update_params(impl->playback, params, 1); } -static void state_changed(void *data, enum pw_stream_state old, +static void capture_state_changed(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { struct impl *impl = data; @@ -1048,7 +1048,9 @@ static void param_changed(void *data, uint32_t id, const struct spa_pod *param, struct spa_audio_info_raw info; spa_zero(info); if (param == NULL) { - spa_filter_graph_deactivate(graph); + pw_log_info("module %p: filter deactivate", impl); + if (capture) + spa_filter_graph_deactivate(graph); impl->rate = 0; } else { if ((res = spa_format_audio_raw_parse(param, &info)) < 0) @@ -1087,7 +1089,7 @@ static const struct pw_stream_events in_stream_events = { .destroy = capture_destroy, .process = capture_process, .io_changed = io_changed, - .state_changed = state_changed, + .state_changed = capture_state_changed, .param_changed = capture_param_changed }; @@ -1108,7 +1110,6 @@ static const struct pw_stream_events out_stream_events = { .destroy = playback_destroy, .process = playback_process, .io_changed = io_changed, - .state_changed = state_changed, .param_changed = playback_param_changed, };