diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index 7d51289c0..609b1dd1f 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -1109,7 +1110,7 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param struct spa_pod_builder b; const struct spa_pod *params[1]; - if (spa_latency_parse(param, &latency) < 0) + if (param == NULL || spa_latency_parse(param, &latency) < 0) return; spa_pod_builder_init(&b, buffer, sizeof(buffer)); @@ -1121,6 +1122,21 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param pw_stream_update_params(impl->playback, params, 1); } +static void param_tag_changed(struct impl *impl, const struct spa_pod *param) +{ + struct spa_tag_info tag; + const struct spa_pod *params[1] = { param }; + void *state = NULL; + + if (param == 0 || spa_tag_parse(param, &tag, &state) < 0) + return; + + if (tag.direction == SPA_DIRECTION_INPUT) + pw_stream_update_params(impl->capture, params, 1); + else + pw_stream_update_params(impl->playback, params, 1); +} + static void state_changed(void *data, enum pw_stream_state old, enum pw_stream_state state, const char *error) { @@ -1208,6 +1224,9 @@ static void param_changed(void *data, uint32_t id, const struct spa_pod *param) case SPA_PARAM_Latency: param_latency_changed(impl, param); break; + case SPA_PARAM_Tag: + param_tag_changed(impl, param); + break; } return; diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index b03ab191a..d1ad52589 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -171,13 +171,11 @@ struct impl { struct pw_stream *capture; struct spa_hook capture_listener; struct spa_audio_info_raw capture_info; - struct spa_latency_info capture_latency; struct pw_properties *playback_props; struct pw_stream *playback; struct spa_hook playback_listener; struct spa_audio_info_raw playback_info; - struct spa_latency_info playback_latency; unsigned int do_disconnect:1; unsigned int recalc_delay:1; @@ -317,18 +315,16 @@ static void playback_process(void *d) } static void param_latency_changed(struct impl *impl, const struct spa_pod *param, - struct spa_latency_info *info, struct pw_stream *other) + struct pw_stream *other) { struct spa_latency_info latency; uint8_t buffer[1024]; struct spa_pod_builder b; const struct spa_pod *params[1]; - if (spa_latency_parse(param, &latency) < 0) + if (param == NULL || spa_latency_parse(param, &latency) < 0) return; - *info = latency; - spa_pod_builder_init(&b, buffer, sizeof(buffer)); params[0] = spa_latency_build(&b, SPA_PARAM_Latency, &latency); pw_stream_update_params(other, params, 1); @@ -336,6 +332,15 @@ static void param_latency_changed(struct impl *impl, const struct spa_pod *param impl->recalc_delay = true; } +static void param_tag_changed(struct impl *impl, const struct spa_pod *param, + struct pw_stream *other) +{ + const struct spa_pod *params[1] = { param }; + if (param == NULL) + return; + pw_stream_update_params(other, params, 1); +} + static void recalculate_buffer(struct impl *impl) { if (impl->target_delay > 0.0f) { @@ -414,7 +419,10 @@ static void capture_param_changed(void *data, uint32_t id, const struct spa_pod break; } case SPA_PARAM_Latency: - param_latency_changed(impl, param, &impl->capture_latency, impl->playback); + param_latency_changed(impl, param, impl->playback); + break; + case SPA_PARAM_Tag: + param_tag_changed(impl, param, impl->playback); break; } } @@ -453,7 +461,10 @@ static void playback_param_changed(void *data, uint32_t id, const struct spa_pod switch (id) { case SPA_PARAM_Latency: - param_latency_changed(impl, param, &impl->playback_latency, impl->capture); + param_latency_changed(impl, param, impl->capture); + break; + case SPA_PARAM_Tag: + param_tag_changed(impl, param, impl->capture); break; } }