summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-softmixer.h
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2018-12-22 11:51:54 +0100
committerStephane Desneux <stephane.desneux@iot.bzh>2018-12-22 11:51:54 +0100
commitc85fd2f131c73e8c21e05e1ea80b55d6a787dda6 (patch)
tree248aca4a75556e3546a3c89cac43bcffe3ccf634 /plugins/alsa/alsa-softmixer.h
parente0f57e523112e1bc73a04e8615d7a21355f0ce0e (diff)
Implemented the bug cleanup at application exit
Fixes most memory leaks in softmixer. The concept of 'transaction' for dynamic streams has been generalized to the objects created at startup. The cleanup is done via a handle set through a atexit() call. Also added a missing strdup in alsa-api-loop, that fixes a double free. Warning, the bluez-alsa PCM are not closed in this version. This is intentional due to a BUG in the bluealsa ioplug PCM, that crashes upon close (pthread_cancel is used to terminate the io_thread and things get very bad. I have a pending fix for that, relying on a cancellation pipe, but deeper testing must be done). As an effect, only one phone call can be made, else 4a needs to be restarted Change-Id: Idb84cafe15f17c0ef02fcc70296d541dc55a2dcf Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh> Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-softmixer.h')
-rw-r--r--plugins/alsa/alsa-softmixer.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index a8cc6de..346964a 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -101,10 +101,13 @@ typedef struct {
int subdev;
} AlsaDevInfoT;
+#define SND_FORMAT_STRING_LEN 16
+#define SND_FORMAT_DEFAULT "S16_LE"
+
typedef struct {
unsigned int rate;
unsigned int channels;
- const char *formatS;
+ char formatString[SND_FORMAT_STRING_LEN];
snd_pcm_format_t format;
snd_pcm_access_t access;
size_t sampleSize;
@@ -238,7 +241,7 @@ typedef struct {
} AlsaSndPcmT;
typedef struct {
- const char*uid;
+ char * uid;
int index;
int numid;
struct cds_list_head list;
@@ -305,7 +308,11 @@ typedef struct SoftMixerT_{
unsigned int nbRamps;
AlsaVolRampT ramps;
- AlsaMixerTransaction * transaction;
+ AlsaMixerTransaction * transaction; // current transaction
+
+ struct cds_list_head list; // node to list of all mixers
+
+ struct cds_list_head transactionList; // all transactions of this mixer
} SoftMixerT;
// alsa-utils-bypath.c
@@ -368,12 +375,16 @@ PUBLIC int ApiStreamAttach(SoftMixerT *mixer, AFB_ReqT request, const char * uid
PUBLIC int ApiZoneAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object * argsJ);
PUBLIC int ApiRampAttach(SoftMixerT *mixer, AFB_ReqT request, const char *, json_object *argsJ);
+PUBLIC void loopsDisplay(SoftMixerT * mixer);
+
// helper used for attach verb,and also by the streams API for fake zones
PUBLIC AlsaSndZoneT * zoneCreate(SoftMixerT* mixer, const char * uid, json_object * argsJ);
PUBLIC AlsaLoopSubdevT *ApiLoopFindSubdev(SoftMixerT *mixer, const char *streamUid, const char *targetUid, AlsaSndLoopT **loop);
PUBLIC AlsaPcmHwInfoT *ApiPcmSetParams(SoftMixerT *mixer, const char *uid, json_object *paramsJ);
+PUBLIC AlsaPcmHwInfoT* ApiPcmParamsDup(SoftMixerT* mixer, AlsaPcmHwInfoT* params);
+PUBLIC void ApiPcmParamsShow(SoftMixerT * mixer, const char * msg, const AlsaPcmHwInfoT * params);
PUBLIC void ApiPcmDelParams(SoftMixerT*, AlsaPcmHwInfoT*);
PUBLIC AlsaSndPcmT *ApiPcmAttachOne(SoftMixerT *mixer, const char *uid, snd_pcm_stream_t direction, json_object *argsJ);