From 283bf0a4ab7dbd6f4393f6a1b4ef5a201ee92f62 Mon Sep 17 00:00:00 2001 From: Thierry Bultel Date: Wed, 11 Jul 2018 17:50:44 +0200 Subject: stops the read/write loop when the stream is muted when the stream is muted (due to the configuration, or due to a HAL request), the read/write loop is stopped. The benefit is that muting will work with capture devices that do not implement the mute in their driver. The inconvenient of stopping the read loop is that it has made appear an unexpected side-effect: the poll on capture does not trig for further incoming frames. The workaround is to completely close, then reopen and configure the capture PCM. Signed-off-by: Thierry Bultel --- plugins/alsa/alsa-api-mixer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'plugins/alsa/alsa-api-mixer.c') diff --git a/plugins/alsa/alsa-api-mixer.c b/plugins/alsa/alsa-api-mixer.c index e3538f8..ebb3f10 100644 --- a/plugins/alsa/alsa-api-mixer.c +++ b/plugins/alsa/alsa-api-mixer.c @@ -31,6 +31,7 @@ static void MixerRemoveVerb(AFB_ReqT request) { for (int idx = 0; mixer->streams[idx]->uid; idx++) { AlsaStreamAudioT *stream = mixer->streams[idx]; + AlsaPcmCopyHandleT * copy = stream->copy; AFB_ApiNotice(mixer->api, "cleaning mixer=%s stream=%s", mixer->uid, stream->uid); @@ -47,10 +48,10 @@ static void MixerRemoveVerb(AFB_ReqT request) { } // free audio-stream dynamic structures - snd_pcm_close(mixer->streams[idx]->copy->pcmIn); - snd_pcm_close(mixer->streams[idx]->copy->pcmOut); - if (stream->copy->evtsrc) sd_event_source_unref(stream->copy->evtsrc); - if (stream->copy->sdLoop) sd_event_unref(stream->copy->sdLoop); + snd_pcm_close(copy->pcmIn->handle); + snd_pcm_close(copy->pcmOut->handle); + if (copy->evtsrc) sd_event_source_unref(copy->evtsrc); + if (copy->sdLoop) sd_event_unref(copy->sdLoop); } // // (Fulup to be Done) registry is attached to source -- cgit 1.2.3-korg