From 7687aea64ee6505818a563b6aa42303ab9be2e78 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Tue, 9 Apr 2019 10:40:10 +1000 Subject: Updates for latest libavirt, adds avirt cleanup Cleanup for avirt is introduced. There are still some issues with this when invoked whilst a PCM is active, This now allows 4A to be restarted without a reboot. Loops must be deleted last to avoid any cleanup issues, so to enforce this a new transaction API is added: AlsaMixerTransactionObjectAddTail. Change-Id: Ieac6a2f163f40af55ee3c33ab63cc534df88769a Signed-off-by: Mark Farrugia --- plugins/alsa/alsa-api-loop.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins/alsa/alsa-api-loop.c') diff --git a/plugins/alsa/alsa-api-loop.c b/plugins/alsa/alsa-api-loop.c index 7949c63..a4595dc 100644 --- a/plugins/alsa/alsa-api-loop.c +++ b/plugins/alsa/alsa-api-loop.c @@ -159,7 +159,7 @@ STATIC AlsaLoopSubdevT *ProcessOneAvirtSubdev(SoftMixerT *mixer, AlsaSndLoopT *l } error = snd_avirt_stream_new(uid, zone->ccount, - SND_PCM_STREAM_PLAYBACK, "ap_loopback"); + SND_PCM_STREAM_PLAYBACK, "ap_loopback", false); if (error < 0) { AFB_API_ERROR(mixer->api, "%s: mixer=%s stream=%s could not create AVIRT stream [errno=%d]", @@ -364,7 +364,7 @@ STATIC AlsaSndLoopT *AttachOneLoop(SoftMixerT *mixer, const char *uid, json_obje goto fail_snd_card; } - snd_avirt_card_seal(); + snd_avirt_card_configure(); // try to open sound card control interface loop->sndcard->ctl = AlsaByPathOpenCtl(mixer, loop->uid, loop->sndcard); @@ -414,6 +414,10 @@ static void loopDestroy(SoftMixerT * mixer, void* arg) { mixer->nbLoops--; cds_list_del(&loop->list); + + if (loop->avirt) + snd_avirt_card_unconfigure(); + free(loop); AFB_API_DEBUG(mixer->api, "DONE !"); @@ -428,7 +432,8 @@ static AlsaSndLoopT * loopCreate(SoftMixerT *mixer, const char *uid, json_object mixer->nbLoops++; cds_list_add(&newLoop->list, &mixer->loops.list); - AlsaMixerTransactionObjectAdd(mixer->transaction, newLoop, loopDestroy); + /* We need the loops to be at the end of the list, so that they are destroyed last */ + AlsaMixerTransactionObjectAddTail(mixer->transaction, newLoop, loopDestroy); loopsDisplay(mixer); -- cgit 1.2.3-korg