From 9cdb3607e1b0f841b64236c4b613504b0c8a7ec9 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 30 Oct 2023 11:20:52 +0100 Subject: [PATCH] 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 --- spa/plugins/alsa/alsa-pcm-sink.c | 5 +++++ spa/plugins/alsa/alsa-pcm-source.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/spa/plugins/alsa/alsa-pcm-sink.c b/spa/plugins/alsa/alsa-pcm-sink.c index 783946403..a0731f7c3 100644 --- a/spa/plugins/alsa/alsa-pcm-sink.c +++ b/spa/plugins/alsa/alsa-pcm-sink.c @@ -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); diff --git a/spa/plugins/alsa/alsa-pcm-source.c b/spa/plugins/alsa/alsa-pcm-source.c index 74ea6e029..4e783aa92 100644 --- a/spa/plugins/alsa/alsa-pcm-source.c +++ b/spa/plugins/alsa/alsa-pcm-source.c @@ -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);