summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-transaction.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-transaction.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-transaction.h')
-rw-r--r--plugins/alsa/alsa-transaction.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/alsa/alsa-transaction.h b/plugins/alsa/alsa-transaction.h
index a0af0ae..dd6e91b 100644
--- a/plugins/alsa/alsa-transaction.h
+++ b/plugins/alsa/alsa-transaction.h
@@ -13,7 +13,8 @@ typedef void (*AlsaTransactionDestructor) (struct SoftMixerT_ *, void*);
typedef struct {
const char * uid;
struct SoftMixerT_* mixer;
- struct cds_list_head list;
+ struct cds_list_head item_list; // list of items
+ struct cds_list_head transaction_node; // node in a list of transactions
} AlsaMixerTransaction;
typedef struct {
@@ -24,10 +25,14 @@ typedef struct {
extern AlsaMixerTransaction * AlsaMixerTransactionNew(struct SoftMixerT_ * api, const char*);
+extern void AlsaMixerTransactionDelete(AlsaMixerTransaction * transaction);
+
extern void AlsaMixerTransactionDataListDestroy(AlsaMixerTransaction*);
extern bool AlsaMixerTransactionObjectAdd(AlsaMixerTransaction*, void * object, AlsaTransactionDestructor destructor);
+extern void AlsaMixerTransactionObjectForget(AlsaMixerTransaction* list, void * object);
+
extern void AlsaMixerTransactionDoCleanup(AlsaMixerTransaction*);
extern bool AlsaMixerTransactionVerbCreate(AlsaMixerTransaction*);