[Blink] Blink for Linux hangs on second call when using PulseAudio input device

Adrian Georgescu ag at ag-projects.com
Sat Aug 17 18:17:29 CEST 2019


This patch it made in to trunk and will be available with next Blink release!

Adrian

> On 15 Jul 2019, at 14:48, juleg.ch at gmail.com wrote:
> 
> Hi
> 
> I just like to confirm.
> Following Tom's advise, I recompiled python-sipsimple with
> 'snd_pcm_drop (pcm)' instead of 'snd_pcm_drain (pcm)' in alsa_dev.c and it works all fine now and the PA device doesn't hang after finishing the call.
> 
> Thanks for this solution!
> 
> Regards, Michael
> 
>> I've been looking into this and once it's hung, you can hook into the
>> thread with the highest cpu usage with gdb and it appears that
>> python-sipsimple is stuck in the alsa function `snd_pcm_drain (pcm);` (
>> https://github.com/AGProjects/python-sipsimple/blob/master/deps/pjsip/pjmedia/src/pjmedia-audiodev/alsa_dev.c#L619 <https://github.com/AGProjects/python-sipsimple/blob/master/deps/pjsip/pjmedia/src/pjmedia-audiodev/alsa_dev.c#L619>).
>> I'm not sure if it's the right approach, but the documentation for that
>> function says:
>> 
>> "For stopping the PCM stream immediately, use ::snd_pcm_drop() instead."
>> 
>> 
>> Switching to that function fixes things for me.
>> Michael,
>> 
>> Another option is to tell PA to ignore certain devices.  I use this for a
>> few devices I never want in PA:
>> 
>> $ cat /etc/udev/rules.d/89-pulseaudio-usb.rules
>> > # Ignore SignaLink
>> 
>> ATTRS{idVendor}=="08bb", ATTRS{idProduct}=="2904", ENV{PULSE_IGNORE}="1"
>> > # Ignore Alesis iO|2
>> > ATTRS{idVendor}=="13b2", ATTRS{idProduct}=="0008", ENV{PULSE_IGNORE}="1"
>> 
>> 
>> The ENV{PULSE_IGNORE}="1" is the key to PA leaving it alone.
>> 
>> The vendor and product ID aren't hard to find.  For example, for the old
>> Alesis I use only in JACK:
>> 
>> $ lsusb | grep Alesis
>> > Bus 002 Device 002: ID 13b2:0008 Alesis
>> 
>> 
>> This is on Arch although I suspect it will work the same regardless of the
>> specific PA implementation.
>> 
>> If PA is ignoring your USB headset, you should be able to use it directly
>> in Blink by selecting it in the devices drop-down menus, no?  I don't know
>> that you'll need to go crazy with the loopback device.  In my case I need
>> it only because of the JACK involvement.
>> 
>> 
>> - Jeff
>> 
>> 
>> 
>> 
>> On Sat, May 11, 2019 at 8:15 AM juleg.ch at gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink> <juleg.ch at gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink>>
>> wrote:
>> 
>> > Jeff,
>> >
>> > Thanks a lot for your reply.
>> >
>> > My problems occur while using a USB headset device.
>> > So I can imagine, that with the help of your asound.conf file as a
>> > template, I should be able to configure 2 alsa loopback devices for
>> > exclusiv use in Blink.
>> >
>> > As a temporary workaround for the moment, I disabled the USB audio via
>> > pavucontrol configuration altogether, so it is only seen and selected by
>> > Blink and doesn't pop up in PA at all while accepting or doing phone calls.
>> >
>> > Regards,
>> > Michael
>> >
>> > Date: Tue, 7 May 2019 11:07:17 -0400
>> > From: Jeff Pyle <jeff at ugnd.org <https://lists.ag-projects.com/mailman/listinfo/blink>> <jeff at ugnd.org <https://lists.ag-projects.com/mailman/listinfo/blink>>
>> > To: Blink Support Forum <blink at lists.ag-projects.com <https://lists.ag-projects.com/mailman/listinfo/blink>> <blink at lists.ag-projects.com <https://lists.ag-projects.com/mailman/listinfo/blink>>
>> > Subject: Re: [Blink] Blink for Linux hangs on second call when using
>> > 	PulseAudio input device
>> > Message-ID:
>> > 	<CAPhW+0KZhW+yzVrngDUeiN8bFMHpd6fRr2dpTUvCiyNNFz_fcg at mail.gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink>> <CAPhW+0KZhW+yzVrngDUeiN8bFMHpd6fRr2dpTUvCiyNNFz_fcg at mail.gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink>>
>> > Content-Type: text/plain; charset="utf-8"
>> >
>> > Michael,
>> >
>> > My case is likely different, as my goal was to use a JACK-connected audio
>> > device in Blink.  JACK and PA play reasonably well together, but since PA
>> > and Blink don't sometimes, I created an ALSA loopback, integrated it into
>> > my JACK flow, and use it exclusively for connectivity with Blink.  I've
>> > attached my asound.conf.
>> >
>> > Once I have JACK started, I run a script called loop2jack, also attached.
>> > This creates two JACK devices, cloop and ploop, the "capture" loop and
>> > "playback" loop devices, respectively.  In Blink the devices appear as
>> > "Loopback, Loopback PCM" for input and output devices.  Blink does support
>> > JACK natively, but Blink's capture and playback connectors only appear when
>> > the audio device is actively in use.  I don't have any auto-patching
>> > mechanisms running in my JACK environment so this wasn't compatible.  I
>> > find the ALSA loopback approach very good for my needs.
>> >
>> > I also have trouble keeping the loopback PCM device playback level at 100%
>> > in alsamixer.  I haven't spent much time on it.
>> >
>> > All that said...  if you can configure Blink to use your audio device with
>> > ALSA directly, rather than PA, you should be okay, no?  PA will release it,
>> > and you won't have any of the Blink+PA problems we've seen.
>> >
>> >
>> > - Jeff
>> >
>> >
>> > On Sun, May 5, 2019 at 1:48 PM juleg.ch at gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink> <juleg.ch at gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink>> <juleg.ch at gmail.com <https://lists.ag-projects.com/mailman/listinfo/blink>>
>> > wrote:
>> >
>> >
>> > Hello
>> >
>> > It seams, that I'm experiencing the same problems here (Debian Stretch,
>> > Blink 3.2.0)
>> > After doing or receiving a call, Blink's cpu usage goes up to almost
>> > 100%. Also the application hangs afterward and I have to kill the
>> > process and start again to continue.
>> > PulseAudio shows a device "ALSA plug-in [python2.7]" in the recording
>> > section of pavucontrol which is not released until the killing of the
>> > process manually.
>> >
>> > Jeff, apparently you managed to find a workaround for this problem. I've
>> > read about ALSA-loopback devices under your posted linkhttps://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge <linkhttps://alsa.opensrc.org/Jack_and_Loopback_device_as_Alsa-to-Jack_bridge>
>> > but I have no clue how this could help bypassing PA and solving the
>> > problem in Blink. May be you could elaborate a little bit more how you
>> > installed this virtual device (example section of .asoundrc?) and what
>> > device one have to select in Blink for input/output? Can this
>> > workaround coexist with installed PA?
>> >
>> > Any help on this would be highly appreciated because I like the
>> > application a lot, especially because it's written in Python and it's
>> > possible for me to understand the source code an to do little
>> > adjustments if needed.
>> >
>> > Regards
>> > Michael
>> >
> 
> _______________________________________________
> Blink mailing list
> Blink at lists.ag-projects.com
> https://lists.ag-projects.com/mailman/listinfo/blink

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ag-projects.com/pipermail/blink/attachments/20190817/b1ab31e0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.ag-projects.com/pipermail/blink/attachments/20190817/b1ab31e0/attachment.sig>


More information about the Blink mailing list