mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-20 09:10:03 +01:00
audioconvert: handle filter-graph setup better
Force filter graph reconfiguration in setup_convert. When adding/removing filter-graphs, only perform setup when we were already setup, otherwise we will do this in setup_convert later. Don't do channelmix_init when we were not setup. Deactivate the filter-graphs when we suspend. Fixes #4866
This commit is contained in:
parent
cb6e61af49
commit
8c9c378e9f
1 changed files with 10 additions and 5 deletions
|
|
@ -1029,7 +1029,7 @@ static int setup_filter_graph(struct impl *this, struct filter_graph *g,
|
||||||
char rate_str[64], in_ports[64];
|
char rate_str[64], in_ports[64];
|
||||||
struct dir *dir;
|
struct dir *dir;
|
||||||
|
|
||||||
if (g == NULL || g->graph == NULL || g->setup)
|
if (g->graph == NULL || g->setup)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
dir = &this->dir[SPA_DIRECTION_REVERSE(this->direction)];
|
dir = &this->dir[SPA_DIRECTION_REVERSE(this->direction)];
|
||||||
|
|
@ -1133,7 +1133,7 @@ static int ensure_tmp(struct impl *this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int setup_filter_graphs(struct impl *impl)
|
static int setup_filter_graphs(struct impl *impl, bool force)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
uint32_t channels, *position;
|
uint32_t channels, *position;
|
||||||
|
|
@ -1150,6 +1150,8 @@ static int setup_filter_graphs(struct impl *impl)
|
||||||
spa_list_for_each_safe(g, t, &impl->active_graphs, link) {
|
spa_list_for_each_safe(g, t, &impl->active_graphs, link) {
|
||||||
if (g->removing)
|
if (g->removing)
|
||||||
continue;
|
continue;
|
||||||
|
if (force)
|
||||||
|
g->setup = false;
|
||||||
if ((res = setup_filter_graph(impl, g, channels, position)) < 0) {
|
if ((res = setup_filter_graph(impl, g, channels, position)) < 0) {
|
||||||
g->removing = true;
|
g->removing = true;
|
||||||
spa_log_warn(impl->log, "failed to activate graph %d: %s", g->order,
|
spa_log_warn(impl->log, "failed to activate graph %d: %s", g->order,
|
||||||
|
|
@ -1266,7 +1268,8 @@ static int load_filter_graph(struct impl *impl, const char *graph, int order)
|
||||||
|
|
||||||
spa_log_info(impl->log, "loading filter-graph order:%d", order);
|
spa_log_info(impl->log, "loading filter-graph order:%d", order);
|
||||||
}
|
}
|
||||||
res = setup_filter_graphs(impl);
|
if (impl->setup)
|
||||||
|
res = setup_filter_graphs(impl, false);
|
||||||
|
|
||||||
spa_loop_invoke(impl->data_loop, do_sync_filter_graph, 0, NULL, 0, true, impl);
|
spa_loop_invoke(impl->data_loop, do_sync_filter_graph, 0, NULL, 0, true, impl);
|
||||||
|
|
||||||
|
|
@ -1390,6 +1393,7 @@ static int parse_prop_params(struct impl *this, struct spa_pod *params)
|
||||||
}
|
}
|
||||||
if (changed) {
|
if (changed) {
|
||||||
this->props.filter_graph_disabled = filter_graph_disabled;
|
this->props.filter_graph_disabled = filter_graph_disabled;
|
||||||
|
if (this->setup)
|
||||||
channelmix_init(&this->mix);
|
channelmix_init(&this->mix);
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
@ -2359,7 +2363,7 @@ static int setup_convert(struct impl *this)
|
||||||
|
|
||||||
if ((res = setup_in_convert(this)) < 0)
|
if ((res = setup_in_convert(this)) < 0)
|
||||||
return res;
|
return res;
|
||||||
if ((res = setup_filter_graphs(this)) < 0)
|
if ((res = setup_filter_graphs(this, true)) < 0)
|
||||||
return res;
|
return res;
|
||||||
if ((res = setup_resample(this)) < 0)
|
if ((res = setup_resample(this)) < 0)
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -2420,6 +2424,7 @@ static int impl_node_send_command(void *object, const struct spa_command *comman
|
||||||
this->started = true;
|
this->started = true;
|
||||||
break;
|
break;
|
||||||
case SPA_NODE_COMMAND_Suspend:
|
case SPA_NODE_COMMAND_Suspend:
|
||||||
|
reset_node(this);
|
||||||
this->setup = false;
|
this->setup = false;
|
||||||
SPA_FALLTHROUGH;
|
SPA_FALLTHROUGH;
|
||||||
case SPA_NODE_COMMAND_Pause:
|
case SPA_NODE_COMMAND_Pause:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue