summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-route.c
diff options
context:
space:
mode:
authorThierry Bultel <thierry.bultel@iot.bzh>2019-02-13 11:59:45 +0100
committerThierry Bultel <thierry.bultel@iot.bzh>2019-02-18 15:51:30 +0100
commit297aa8309743d570b801e917f637937c0fc904c7 (patch)
tree85d41c16bc9d84410ad96a7a66ebadae9bcd9692 /plugins/alsa/alsa-plug-route.c
parentc0c670aab4d1cb87f7f49031ec8728d6f1701fe3 (diff)
pcm plugs: rework the alsa config cleanup
The alsa config (for softvol, routes, rate conversion ...) was cleaned up by the owner stream or zone, at their deletion time. This was a mistake, because when the stream or zone creation was not complete, the cleanup of the configuration was not done. Instead of doing that, the config is attached to the plug objects as private data (in the AlsaPcmCtlT structure). Since the AlsaPcmCtlT are always recorded in the creation transaction, it is easy to call the cleaning callback (when it exists) when the transaction is deleted. Change-Id: I952871518a20bfe0be6398887bc747338cf574fb Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-plug-route.c')
-rw-r--r--plugins/alsa/alsa-plug-route.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-plug-route.c b/plugins/alsa/alsa-plug-route.c
index 8b49f99..72dee68 100644
--- a/plugins/alsa/alsa-plug-route.c
+++ b/plugins/alsa/alsa-plug-route.c
@@ -23,6 +23,14 @@
ALSA_PLUG_PROTO(route);
+static void routeConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * routeConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... route config", __func__);
+ snd_config_delete(routeConfig);
+ snd_config_update();
+}
+
+
typedef struct {
const char *uid;
const char *cardid;
@@ -81,7 +89,7 @@ OnErrorExit:
}
PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int open) {
- snd_config_t *routeConfig, *elemConfig, *slaveConfig, *tableConfig, *pcmConfig;
+ snd_config_t *routeConfig = NULL, *elemConfig, *slaveConfig, *tableConfig, *pcmConfig;
int error = 0;
ChannelCardPortT slave, channelCardPort;
AlsaPcmCtlT *pcmRoute = NULL;
@@ -279,7 +287,8 @@ PUBLIC AlsaPcmCtlT* AlsaCreateRoute(SoftMixerT *mixer, AlsaSndZoneT *zone, int o
goto fail;
}
- zone->routeConfig = routeConfig;
+ pcmRoute->private_data = routeConfig;
+ pcmRoute->private_data_clean = routeConfigClean;
// Debug config & pcm
AFB_API_NOTICE(mixer->api, "%s: zone(%s) DONE", __func__, zone->uid);