filter-chain: reset graph in suspend

To make sure we don't end up with samples from before the suspend.
This commit is contained in:
Wim Taymans 2021-05-12 20:48:00 +02:00
parent 32688d7fc6
commit a6c0e35b13

View file

@ -553,6 +553,19 @@ static int parse_params(struct graph *graph, const struct spa_pod *pod)
return changed;
}
static void graph_reset(struct graph *graph)
{
uint32_t i;
for (i = 0; i < graph->n_hndl; i++) {
struct graph_hndl *hndl = &graph->hndl[i];
const LADSPA_Descriptor *d = hndl->desc;
if (d->deactivate)
d->deactivate(hndl->hndl);
if (d->activate)
d->activate(hndl->hndl);
}
}
static void param_changed(void *data, uint32_t id, const struct spa_pod *param)
{
struct impl *impl = data;
@ -561,6 +574,10 @@ static void param_changed(void *data, uint32_t id, const struct spa_pod *param)
struct graph *graph = &impl->graph;
int changed = 0;
if (id == SPA_PARAM_Format && param == NULL) {
graph_reset(graph);
return;
}
if (id != SPA_PARAM_Props)
return;