filter-chain: fix parsing when control isn't last

Control had to be defined last, because after it the parser would
start skipping keys and fail to set rest of the params.
This commit is contained in:
jicksaw 2021-08-10 04:16:22 +03:00 committed by Wim Taymans
parent bf91be5d61
commit b4976728c3

View file

@ -1124,6 +1124,7 @@ static int load_node(struct graph *graph, struct spa_json *json)
char label[256] = "";
bool have_control = false;
uint32_t i;
int len;
while (spa_json_get_string(json, key, sizeof(key)) > 0) {
if (spa_streq("type", key)) {
@ -1149,6 +1150,11 @@ static int load_node(struct graph *graph, struct spa_json *json)
} else if (spa_streq("control", key)) {
it[0] = *json;
have_control = true;
len = spa_json_next(json, &val);
if (!spa_json_is_object(val, len)) {
pw_log_error("control expects an object");
return -EINVAL;
}
} else if (spa_json_next(json, &val) < 0)
break;
}