The actual error is:
"snd_pcm_avail() returned a value that is exceptionally large"
and obviously is some bug in pulseaudio. I discovered some sites claiming to have a solution (like this) but nothing helped.
So last night I decided to remove the annoying pulseaudio.
I did as suggested in this site. Note, I did backup ~/.asoundrc, ~/.pulse and /etc/asound.conf just to be on the safe side.
Then use:
touch ~/.pulse-a11y-nostart echo autospawn = no|tee -a ~/.pulse/client.conf killall pulseaudio
to kill pulseaudio and tell it to please do not appear again. If you happen to want it back, you can use:
rm .pulse-a11y-nostart ~/.pulse/client.conf .asoundrc.
Unfortunately, it continued to start on reboot. I tried to uninstall it, but it turned out that the whole KDE depends in some mystical way on it, so I found the other solution:
mv /usr/bin/pulseaudio /usr/bin/pulsestop
That removes the bin file of pulseaudio and it cannot start even if it wants to. Oh, well.
Next thing was that I had problems with amarok not wanting to play music. It turned out that my first backend is "vlc" and not "xine". After putting "xine" on fist place, sound appeared.
I also used the .asoundrc suggested in the file above:
pcm.dsp { type plug slave.pcm "dmixer" } pcm.!default { type plug slave.pcm "dmixer" } ctl.!default { type hw card 0 } pcm.dmixer { type dmix ipc_key 1024 slave { pcm "hw:0,0" period_time 0 # period_time 84000 # period_size 2048 # buffer_time 340000 rate 44100 # rate 48000 period_size 1024 # buffer_size 2052 buffer_size 4096 # this is the size of buffer I use # buffer_size 8192 # buffer_size 16384 } bindings { 0 0 1 1 } } ctl.dmixer { type hw card 0 }Now everything seems to work fine. Amarok plays music. Juk plays music. If you stop Amarok and then run Flash, it has sounds. They won't work simultaneously, even though Amarok and Juk work in the same time. Anyway, this is very small problem compared to the disastrous bug in pulseaudio that made me lose hours in the recent weeks. Now everything is calm and nice. :)