summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-plug-vol.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-05-13 13:55:58 +0200
commite355716f6bac57615195333559a746e283e22060 (patch)
tree5fa207017fd653449f0dee932dcf1f84a11c9b71 /plugins/alsa/alsa-plug-vol.c
parenteb45566268d0bbb7df9e30f733a95d79275eb3a7 (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-vol.c')
-rw-r--r--plugins/alsa/alsa-plug-vol.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/alsa/alsa-plug-vol.c b/plugins/alsa/alsa-plug-vol.c
index 09025c4..ade29ac 100644
--- a/plugins/alsa/alsa-plug-vol.c
+++ b/plugins/alsa/alsa-plug-vol.c
@@ -22,8 +22,13 @@
ALSA_PLUG_PROTO(softvol); // stream uses softvol plugin
-PUBLIC void AlsaDeleteSoftvol(SoftMixerT *mixer, AlsaPcmCtlT * ctl) {
+
+static void softVolConfigClean(SoftMixerT *mixer, void * arg) {
+ snd_config_t * softvolConfig = arg;
+ AFB_API_DEBUG(mixer->api, "%s... softvol config", __func__);
+ snd_config_delete(softvolConfig);
+ snd_config_update();
}
PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *stream, char* slaveid, AlsaSndCtlT *sndcard, char* ctlName, int max, int open) {
@@ -95,7 +100,8 @@ PUBLIC AlsaPcmCtlT *AlsaCreateSoftvol(SoftMixerT *mixer, AlsaStreamAudioT *strea
goto OnErrorExit;
}
- stream->softvolConfig = streamConfig;
+ pcmVol->private_data = streamConfig;
+ pcmVol->private_data_clean = softVolConfigClean;
// Debug config & pcm
//AlsaDumpCtlConfig (mixer, "plug-config", pcmConfig, 1);