diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index 17f891b94..3550871c3 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -1112,6 +1112,18 @@ static void state_changed(void *data, enum pw_stream_state old, } } +static void param_format_cleared(struct impl *impl, struct pw_stream *other, + struct spa_audio_info_raw *other_info) +{ + uint8_t buffer[1024]; + struct spa_pod_builder b; + const struct spa_pod *params[1]; + + spa_pod_builder_init(&b, buffer, sizeof(buffer)); + params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, other_info); + pw_stream_update_params(other, params, 1); +} + static void param_changed(void *data, uint32_t id, const struct spa_pod *param) { struct impl *impl = data; @@ -1122,6 +1134,8 @@ static void param_changed(void *data, uint32_t id, const struct spa_pod *param) case SPA_PARAM_Format: if (param == NULL) { graph_cleanup(graph); + param_format_cleared(impl, impl->capture, &impl->capture_info); + param_format_cleared(impl, impl->playback, &impl->playback_info); } else { struct spa_audio_info_raw info; spa_zero(info); diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index b80e90802..9e9b3d926 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -323,6 +323,18 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param impl->recalc_delay = true; } +static void param_format_cleared(struct impl *impl, struct pw_stream *other, + struct spa_audio_info_raw *other_info) +{ + uint8_t buffer[1024]; + struct spa_pod_builder b; + const struct spa_pod *params[1]; + + spa_pod_builder_init(&b, buffer, sizeof(buffer)); + params[0] = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, other_info); + pw_stream_update_params(other, params, 1); +} + static void stream_state_changed(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { @@ -377,8 +389,10 @@ static void capture_param_changed(void *data, uint32_t id, const struct spa_pod case SPA_PARAM_Format: { struct spa_audio_info_raw info; - if (param == NULL) + if (param == NULL) { + param_format_cleared(impl, impl->playback, &impl->playback_info); return; + } if (spa_format_audio_raw_parse(param, &info) < 0) return; if (info.rate == 0 || @@ -416,6 +430,12 @@ static void playback_param_changed(void *data, uint32_t id, const struct spa_pod struct impl *impl = data; switch (id) { + case SPA_PARAM_Format: + if (param == NULL) { + param_format_cleared(impl, impl->capture, &impl->capture_info); + return; + } + break; case SPA_PARAM_Latency: param_latency_changed(impl, param, &impl->playback_latency, impl->capture); break;