[Home]

Summary:ASTERISK-01102: chan_alsa.so aborts
Reporter:justin (justin)Labels:
Date Opened:2004-02-25 16:58:00.000-0600Date Closed:2004-09-25 02:53:46
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_alsa.c.hangup-fix.patch
( 1) chan_alsa.c.patch
Description:Using a Soundblaster LIVE! (emu10k1)

Get the same error as mentioned in 0000526.

[chan_alsa.so] => (ALSA Console Channel Driver)
asterisk: pcm.c:5486: snd_pcm_sw_params_set_silence_threshold: Assertion `val < pcm->buffer_size' failed.
Aborted

With both 0.72 as with the lastest cvs version.
When using OSS I get WARNING[1150528304]: Read error on sound device: Resource temporarily unavailable

Soundcard works fine with other applications.

Any suggestions?
Comments:By: Brian West (bkw918) 2004-02-27 00:14:33.000-0600

I think its doing what it should.  If you noload => chan_alsa.so in modules.conf does it start up?  If so then its doing what it should when it can't load the module at start up.

By: justin (justin) 2004-02-27 01:35:33.000-0600

Yes with noload => chan_alsa.so asterisk starts up.

What I mean to find out is why chan_alsa.so won't start.
"alsaplayer" and "alsamixer" work fine.
Any idea how to find out why asterisk is not able to startup chan_alsa.so?

Using Redhat9/kernel-2.4.20-20.9/alsa-0.98.

By: Mark Spencer (markster) 2004-02-27 02:25:38.000-0600

Is there anyone with alsa that can provide some assistance?

By: justin (justin) 2004-02-27 05:09:50.000-0600

Also tried it on a fedora installation, with the RPM's supplied at ftp://ftp.nacs.net/asterisk/fc1 and with the cvs version.
Now it just segfaults

[chan_alsa.so] => (ALSA Console Channel Driver)
Segmentation fault

chan_oss also still gives Read error on sound device: Resource temporarily unavailable.

Again all other sound applications are happy with the alsa and oss config.

By: Brian West (bkw918) 2004-02-27 14:46:56.000-0600

Make sure nothing else is using the sound card when you start asterisk.

By: mwood (mwood) 2004-02-28 04:28:34.000-0600

I have verified this bug on my system. I am using an SB Live! with alsa 1.0.2 on Gentoo. Asterisk crashes when loading chan_alsa.so. The crash occurs in the alsa_card_init function in chan_alsa.c. Initially it crashes on line 358. I managed to get past this and found that it crashes on two other lines in the same function (364 and 373). They are all calls to set_some_setting_near functions which are alsa functions that attempt to set the particular setting to the requested value but will select the closest obtainable value if the requested value can not be acheived. I managed to load chan_alsa without Asterisk crashing by changing these to not use the near functions. The functions that cause the crash are:

snd_pcm_hw_params_set_rate_near
snd_pcm_hw_params_set_period_size_near
snd_pcm_hw_params_set_buffer_size_near

By changing them to:

snd_pcm_hw_params_set_rate
snd_pcm_hw_params_set_period_size
snd_pcm_hw_params_set_buffer_size

Asterisk will not crash. The problem is that the return values show errors. Rate gets set to 0... period size and buffer size return 'invalid argument'. Obviously that isn't going to work.

This is what I have noted so far. This is on my system and may not apply to other systems. I will look at this some more later.

By: mwood (mwood) 2004-02-28 04:45:22.000-0600

I thought I would add a sidenote. chan_oss.so will load just fine as long as you install the alsa-oss compatible library. You can find it on www.alsa-project.org or in gentoo 'emerge alsa-oss'.

By: justin (justin) 2004-02-28 12:09:24.000-0600

removing '_near" in these functions seems to help for me too, still getting some warning/errors.

[chan_alsa.so] => (ALSA Console Channel Driver)
WARNING[1073863552]: chan_alsa.c:361 alsa_card_init: Rate not correct, requested 8000, got 0
ERROR[1073863552]: chan_alsa.c:366 alsa_card_init: period_size(320 frames) is bad: Invalid argument
WARNING[1073863552]: chan_alsa.c:361 alsa_card_init: Rate not correct, requested 8000, got 0
WARNING[1073863552]: chan_alsa.c:375 alsa_card_init: Problem setting buffer size of 8192: Invalid argument
== Registered channel type 'Console' (ALSA Console Channel Driver)

By: Mark Spencer (markster) 2004-03-21 02:53:54.000-0600

This problem would appear to be within the ALSA drivers.  I recommend one of the bug maintainers, or the bug poster, contact ALSA for assistance.  If there is no activity on this bug, I'm going to mark it as "can't fix" and be done with it.

By: jcdutton (jcdutton) 2004-03-23 23:50:50.000-0600

I have just uploaded a patch here to fix the above problems.

By: jcdutton (jcdutton) 2004-03-24 10:27:55.000-0600

Apply "chan_alsa.c.patch" first, that fixes alsa crash problems.
Apply "fix.patch" second, to fix the problem with the "hangup" command not working.

By: mwood (mwood) 2004-03-24 15:22:31.000-0600

I can confirm that this patch works.

By: Malcolm Davenport (mdavenport) 2004-03-24 16:47:46.000-0600

Changes added to CVS.  Thank you.