[Home]

Summary:ASTERISK-12000: Asterisk startup hangs if another alsa application is running
Reporter:nick_lewis (nick_lewis)Labels:
Date Opened:2008-05-09 04:26:38Date Closed:2008-05-13 15:24:33
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_alsa
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:While an alsa application such as arecord is running (e.g. for live moh) asterisk fails to complete its startup process and instead hangs during the loading of the chan_alsa module. None of the subsequent modules are ever loaded and asterisk therefore behaves unexpectedly.

The problem appears to be present in all asterisk versions

****** ADDITIONAL INFORMATION ******

Compilation with some additional debug suggests that the problem is with the following line in the function alsa_card_init

err = snd_pcm_open(&handle, dev, stream, O_NONBLOCK);

It appears that snd_pcm_open does not understand the O_NONBLOCK flag. A look at alsa documentation indicates that this can be changed to SND_PCM_NONBLOCK as in

err = snd_pcm_open(&handle, dev, stream, SND_PCM_NONBLOCK);

This does seem to resolve the problem.

BTW - there is also the following commented line in chan_alsa.c
/* static int block = O_NONBLOCK; */
This may be a bit misleading and could be removed



Comments:By: Digium Subversion (svnbot) 2008-05-13 15:22:34

Repository: asterisk
Revision: 115944

U   branches/1.4/channels/chan_alsa.c

------------------------------------------------------------------------
r115944 | file | 2008-05-13 15:22:32 -0500 (Tue, 13 May 2008) | 4 lines

Use the right flag to open the audio in non-blocking.
(closes issue ASTERISK-12000)
Reported by: nicklewisdigiumuser

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115944

By: Digium Subversion (svnbot) 2008-05-13 15:23:37

Repository: asterisk
Revision: 115945

_U  trunk/
U   trunk/channels/chan_alsa.c

------------------------------------------------------------------------
r115945 | file | 2008-05-13 15:23:35 -0500 (Tue, 13 May 2008) | 12 lines

Merged revisions 115944 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115944 | file | 2008-05-13 17:28:23 -0300 (Tue, 13 May 2008) | 4 lines

Use the right flag to open the audio in non-blocking.
(closes issue ASTERISK-12000)
Reported by: nicklewisdigiumuser

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115945

By: Digium Subversion (svnbot) 2008-05-13 15:24:33

Repository: asterisk
Revision: 115946

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_alsa.c

------------------------------------------------------------------------
r115946 | file | 2008-05-13 15:24:32 -0500 (Tue, 13 May 2008) | 20 lines

Merged revisions 115945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r115945 | file | 2008-05-13 17:29:27 -0300 (Tue, 13 May 2008) | 12 lines

Merged revisions 115944 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115944 | file | 2008-05-13 17:28:23 -0300 (Tue, 13 May 2008) | 4 lines

Use the right flag to open the audio in non-blocking.
(closes issue ASTERISK-12000)
Reported by: nicklewisdigiumuser

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=115946