gstreamer/ext/alsa
yanghuolin 67a7b5a993 alsasink: don't use 100% CPU
The root cause is that alsa-lib is not thread safe for the same handle.
There are two threads in the gstreamer accessing alsa-lib not serilized.
The race condition happens when one thread holds the old framebuffer app_ptr
position in the kernel, another thread advances the framebuffer app_ptr.
when the former thread is scheduled to run again, it overwrites the app_ptr
to old value by copying from kernel.Thus,the app_ptr in the upper
alsa-lib(pcm_rate) become one period size more advanced than the lower
alsa-lib(pcm_hw & kernel).

gstreamer uses noblock and poll method to communicate with the alsa-lib.
The app_ptr unsync situation as described above makes the poll return immediately because
it concludes there is enough space for the ring-buffer via the low-level alsa-lib.
The write function returns immediately because it concludes there is not enough
space for the ring-buffer from the upper-level alsa-lib. Then the loop of poll
and write runs again and again until another period size is available for
ring-buffer.This leads to the cpu 100 problem.

delay_lock  is used to avoid the race condition.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=690937
2013-01-24 15:08:31 +01:00
..
gstalsa.c Fix FSF address 2012-11-03 23:05:09 +00:00
gstalsa.h Fix FSF address 2012-11-03 23:05:09 +00:00
gstalsadeviceprobe.c Fix FSF address 2012-11-03 23:05:09 +00:00
gstalsadeviceprobe.h Fix FSF address 2012-11-03 23:05:09 +00:00
gstalsaplugin.c Fix FSF address 2012-11-03 23:05:09 +00:00
gstalsasink.c alsasink: don't use 100% CPU 2013-01-24 15:08:31 +01:00
gstalsasink.h alsasink: don't use 100% CPU 2013-01-24 15:08:31 +01:00
gstalsasrc.c alsasrc: return negative value on read error 2012-12-17 20:50:33 +00:00
gstalsasrc.h ext: Fix some compilation errors caused by circular header includes 2012-12-12 17:22:31 +00:00
Makefile.am Revert "gst: Add better support for static plugins" 2012-10-24 13:26:26 +02:00