diff options
Diffstat (limited to 'plugins/alsa/alsa-utils-bypath.c')
-rw-r--r-- | plugins/alsa/alsa-utils-bypath.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/plugins/alsa/alsa-utils-bypath.c b/plugins/alsa/alsa-utils-bypath.c index 908d247..49f89e4 100644 --- a/plugins/alsa/alsa-utils-bypath.c +++ b/plugins/alsa/alsa-utils-bypath.c @@ -91,15 +91,18 @@ PUBLIC void AlsaPcmCtlDelete(SoftMixerT* mixer, void * arg) { AlsaPcmCtlT * pcmCtl = (AlsaPcmCtlT *) arg; + AFB_ApiDebug(mixer->api, "%s of %s (plug: %d)", __func__, pcmCtl->name, pcmCtl->isPcmPlug); + if (!pcmCtl->closeAtDeletion) goto done; + // TODO REMOVE THIS ONCE THE BUG IN BLUEZ-ALSA IS CORRECTED. Else Closing it make SIGSEGV if (pcmCtl->isPcmPlug) { - AFB_ApiDebug(mixer->api, "%s: Wont' close '%s' PCM, its slave is a plug", __func__, pcmCtl->cid.cardid); + AFB_ApiDebug(mixer->api, "%s: Wont' close '%s' PCM, it uses is a plug", __func__, pcmCtl->cid.cardid); goto done; } - AFB_ApiDebug(mixer->api, "%s: Closing %s",__func__, pcmCtl->cid.cardid); + AFB_ApiDebug(mixer->api, "%s: Closing %s", __func__, pcmCtl->cid.cardid); error = snd_pcm_close(pcmCtl->handle); if (error) { // It's safe to ignore this error. In case of ioplug PCM, the device may have already disappeared @@ -109,8 +112,13 @@ PUBLIC void AlsaPcmCtlDelete(SoftMixerT* mixer, void * arg) { done: + ApiPcmDelParams(mixer, pcmCtl->params); + free((char*) pcmCtl->cid.cardid); free(pcmCtl); + + AFB_ApiDebug(mixer->api, "%s DONE", __func__); + } PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcmCtl(SoftMixerT *mixer, AlsaDevInfoT *pcmDev, snd_pcm_stream_t direction) { @@ -156,7 +164,6 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcmCtl(SoftMixerT *mixer, AlsaDevInfoT *pcmDev goto fail_cardid; } - // inherit CID from pcmDev pcmCtl->cid.cardid = pcmDev->cardid; pcmCtl->cid.cardidx = pcmDev->cardidx; @@ -165,6 +172,9 @@ PUBLIC AlsaPcmCtlT *AlsaByPathOpenPcmCtl(SoftMixerT *mixer, AlsaDevInfoT *pcmDev pcmCtl->cid.name=NULL; pcmCtl->cid.longname=NULL; + if (pcmDev->pcmplug_params) + pcmCtl->isPcmPlug = true; + AFB_ApiDebug(mixer->api, "%s OPEN PCM '%s', direction %s", __func__, pcmDev->cardid, direction==SND_PCM_STREAM_PLAYBACK?"playback":"capture"); |