alsa: remove device properties when closed

When the device has not configured a format, remove the properties that
depend on the format so that they don't limit what we can configure the
device with next.

See #3613
This commit is contained in:
Wim Taymans 2023-10-30 11:20:52 +01:00
parent 2ff62641b9
commit 9cdb3607e1
2 changed files with 10 additions and 0 deletions

View file

@ -55,6 +55,11 @@ static void emit_node_info(struct state *this, bool full)
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", nperiods);
snprintf(headroom, sizeof(headroom), "%u", this->headroom);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", headroom);
} else {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_MAX_LATENCY, NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-size", NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", NULL);
}
this->info.props = &SPA_DICT_INIT(items, n_items);

View file

@ -55,6 +55,11 @@ static void emit_node_info(struct state *this, bool full)
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", nperiods);
snprintf(headroom, sizeof(headroom), "%u", this->headroom);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", headroom);
} else {
items[n_items++] = SPA_DICT_ITEM_INIT(SPA_KEY_NODE_MAX_LATENCY, NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-size", NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.period-num", NULL);
items[n_items++] = SPA_DICT_ITEM_INIT("api.alsa.headroom", NULL);
}
this->info.props = &SPA_DICT_INIT(items, n_items);