From ca638334f31f6cafab1bd1eb603710256eb9bc87 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Tue, 6 Nov 2018 13:36:22 +0100 Subject: alsa-core-pcm: fixed the mute logic This fixes the mute/unmute logic. This was broken due to a forgotten push for a commit Change-Id: I6cbdedefc11ebd508d30ece71df364d9b69c74f0 Signed-off-by: Thierry Bultel --- plugins/alsa/alsa-core-pcm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/alsa/alsa-core-pcm.c b/plugins/alsa/alsa-core-pcm.c index fbc8aa3..f80b1e4 100644 --- a/plugins/alsa/alsa-core-pcm.c +++ b/plugins/alsa/alsa-core-pcm.c @@ -454,8 +454,8 @@ static int suspend( snd_pcm_t * pcm, int error) static void readSuspend(AlsaPcmCopyHandleT * pcmCopyHandle) { // will be deaf - pcmCopyHandle->saveFd = pcmCopyHandle->pollFds[0].fd; - pcmCopyHandle->pollFds[0].fd = -1; + pcmCopyHandle->saveFd = pcmCopyHandle->pollFds[1].fd; + pcmCopyHandle->pollFds[1].fd = -1; AFB_ApiNotice(pcmCopyHandle->api, "capture muted"); } @@ -463,7 +463,9 @@ static void readSuspend(AlsaPcmCopyHandleT * pcmCopyHandle) { static void readResume(AlsaPcmCopyHandleT * pcmCopyHandle) { // undeaf it - pcmCopyHandle->pollFds[0].fd = pcmCopyHandle->saveFd; + pcmCopyHandle->pollFds[1].fd = pcmCopyHandle->saveFd; + snd_pcm_prepare(pcmCopyHandle->pcmIn->handle); + snd_pcm_start(pcmCopyHandle->pcmIn->handle); AFB_ApiNotice(pcmCopyHandle->api, "capture unmuted"); } @@ -500,7 +502,7 @@ static void *readThreadEntry(void *handle) { if (err == 0) { /* timeout */ - AFB_ApiDebug(pcmCopyHandle->api, "%s(%s) alive", __func__, pcmCopyHandle->pcmIn->cid.cardid ); + AFB_ApiDebug(pcmCopyHandle->api, "%s(%s) alive, mute %d", __func__, pcmCopyHandle->pcmIn->cid.cardid, muted ); continue; } -- cgit 1.2.3-korg