[Home]

Summary:ASTERISK-22000: chan_alsa fails to use input_device=plug:dsnoop
Reporter:Chris Gentle (gentlec)Labels:
Date Opened:2013-07-02 12:15:08Date Closed:2021-08-10 12:23:05
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_alsa
Versions:11.4.0 13.18.4 Frequency of
Occurrence
Related
Issues:
Environment:Asterisk 11.4.0 on Raspberry Pi with Raspbian 2013-05-25-wheezy. C-Media USB sound card installed.Attachments:( 0) backtrace.txt
Description:Trying to get chan_alsa to use ALSA device plug:dsnoop so that it will not block other processes trying to read from ALSA mic input.  (The dsnoop plugin is the opposite of dmix, it's for mic input rather than speaker output.)  My alsa configuration is the distribution's default without anything added to /etc/asound.conf or ~/.asoundrc.

My goal is to feed an asterisk confbridge with audio from an alsa mic input while simultaneously making a recording of whatever is coming across the microphone jack using arecord with "-f cd" to record it at 44100Hz stereo.

Running simultaneous arecord sessions with plug:dsnoop works without blocking:

{noformat}
for i in `seq 1 5`; do
 arecord -D plug:dsnoop -f cd -d 10 foobar-$i.wav &
done
{noformat}


but using input_device=plug:dsnoop in /etc/alsa.conf fails.


{noformat}
asterisk*CLI> console dial 1001@conferences
   -- Executing [1001@conferences:1] Answer("ALSA/plug:dsnoop", "") in new stack
<< Console call has been answered >>
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
[2013-07-02 09:32:56] ERROR[5374][C-00000000]: chan_alsa.c:479 alsa_read: Read error: Resource temporarily unavailable
{noformat}

I've tested with 11.4.0 on two platforms, one Atom-based and the other was a Raspberry Pi.  On the Atom, a couple of these errors are produced but they are non-fatal and things continue to work as expected.  On the Pi, there are more than two errors (as seen above) and they are fatal resulting in an asterisk crash.
Comments:By: Matt Jordan (mjordan) 2013-07-05 09:20:36.159-0500

Thank you for your bug report. In order to move your issue forward, we require a backtrace[1] from the core file produced after the crash. Also, be sure you have DONT_OPTIMIZE enabled in menuselect within the Compiler Flags section, then:

make install

After enabling, reproduce the crash, and then execute the backtrace[1] instructions. When complete, attach that file to this issue report.

[1] https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace

It'd be good to get a backtrace of the crash on the Pi.

Please note that {{chan_alsa}} is an extended support module and development support for it typically comes from the open source community. Issue response time may reflect that.

By: Chris Gentle (gentlec) 2013-07-08 09:58:57.216-0500

Attaching backtrace from pi.

By: Matt Jordan (mjordan) 2013-07-08 13:13:25.785-0500

No idea what channel driver was executing - ALSA, I presume - but dup'ing a frame with len {{13726456) is probably going to blow up on any low memory device.

{noformat}
#0  0x00107954 in ast_frdup (f=0x15300d2) at frame.c:453
       out = 0x0
       len = 13726456
       srclen = 0
       buf = 0x0
       frames = 0x1e9ab4
       __PRETTY_FUNCTION__ = "ast_frdup"
{noformat}

You should know that {{chan_alsa}} is an extended support module, and development support for it comes primarily from the Asterisk developer community. Response times will reflect that.

By: Sean Bright (seanbright) 2021-08-10 12:23:05.935-0500

I am not able to reproduce with Asterisk 16 (rev af17973b). If you can, feel free to reopen this ticket by commenting on it.