Commit graph

21 commits

Author SHA1 Message Date
Jan Schmidt
614ddaa739 alsasink: Remove unused hwparam/swparam pointers
The ALSA params structures aren't kept. The pointers
aren't used anywhere, so remove them from the struct.
2016-07-15 22:51:35 +10:00
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
Sebastian Dröge
d9b25afe71 ext: Fix some compilation errors caused by circular header includes 2012-12-12 17:22:31 +00:00
Tim-Philipp Müller
5f59b4f7ee Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 23:05:09 +00:00
Tim-Philipp Müller
794af4fc51 alsa: port to new GLib thread API 2012-09-10 01:06:51 +01:00
Wim Taymans
dae848818d audio: rework audio caps.
Rework the audio caps similar to the video caps. Remove
width/depth/endianness/signed fields and replace with a simple string
format and media type audio/x-raw.
Create a GstAudioInfo and some helper methods to parse caps.
Remove duplicate code from the ringbuffer and replace with audio info.
Use AudioInfo in the base audio filter class.
Port elements to new API.
2011-08-18 19:15:03 +02:00
Julien Moutte
f0154849b0 ext/alsa/gstalsa.c: Probe for IEC958 pcm to detect if we can do SPDIF output.
Original commit message from CVS:
2008-02-29  Julien Moutte  <julien@fluendo.com>

* ext/alsa/gstalsa.c: (gst_alsa_open_iec958_pcm),
(gst_alsa_probe_supported_formats): Probe for IEC958 pcm to
detect
if we can do SPDIF output.
* ext/alsa/gstalsa.h:
* ext/alsa/gstalsasink.c: (set_hwparams), (alsasink_parse_spec),
(gst_alsasink_prepare), (gst_alsasink_close),
(gst_alsasink_write):
* ext/alsa/gstalsasink.h: Initial support for SPDIF.
* gst-libs/gst/audio/gstringbuffer.c:
(gst_ring_buffer_parse_caps):
* gst-libs/gst/audio/gstringbuffer.h: Add non linear buffer
types
to support AC3, EC3 and IEC958 buffers.
2008-02-29 18:44:36 +00:00
Wim Taymans
1d0e1586d8 ext/alsa/gstalsasink.*: Remove unused dispose function.
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_class_init),
(gst_alsasink_write), (gst_alsasink_reset):
* ext/alsa/gstalsasink.h:
Remove unused dispose function.
Rename lock to not interfere with alsasrc lock.
* ext/alsa/gstalsasrc.c: (gst_alsasrc_finalize),
(gst_alsasrc_class_init), (gst_alsasrc_init), (set_swparams),
(gst_alsasrc_read), (gst_alsasrc_reset):
* ext/alsa/gstalsasrc.h:
Implement finalize function.
Use lock to protect alsa access.
Implement _reset.
Fine tune sw params.
2007-03-01 16:48:45 +00:00
Tim-Philipp Müller
acde916f7f ext/alsa/gstalsasink.*: Don't leak allocated snd_output_t structure if there's more than one alsasink instance at a t...
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise),
(gst_alsasink_init):
* ext/alsa/gstalsasink.h:
Don't leak allocated snd_output_t structure if there's
more than one alsasink instance at a time (#341873).
Also fix GObject macros in header file.
2006-05-15 16:46:44 +00:00
Wim Taymans
b6e0165934 Added alsa docs.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-base-plugins-docs.sgml:
* docs/plugins/gst-plugins-base-plugins-sections.txt:
* ext/alsa/gstalsamixer.c:
* ext/alsa/gstalsamixer.h:
* ext/alsa/gstalsamixerelement.c:
(gst_alsa_mixer_element_class_init), (gst_alsa_mixer_element_init):
* ext/alsa/gstalsamixerelement.h:
* ext/alsa/gstalsasink.c:
* ext/alsa/gstalsasink.h:
* ext/alsa/gstalsasrc.c: (gst_alsasrc_class_init),
(gst_alsasrc_init):
* ext/alsa/gstalsasrc.h:
Added alsa docs.
Small code cleanups.
2006-03-01 18:25:18 +00:00
Tim-Philipp Müller
943dfba995 ext/alsa/gstalsasink.*: Add support for more than 2 channels (#326720).
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_class_init),
(gst_alsasink_init), (get_channel_free_structure),
(caps_add_channel_configuration), (gst_alsasink_getcaps),
(gst_alsasink_close):
* ext/alsa/gstalsasink.h:
Add support for more than 2 channels (#326720).
2006-02-16 21:01:23 +00:00
Wim Taymans
7aeb1d4587 ext/alsa/gstalsasink.*: Add lock to protect alsa calls.
Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_finalise),
(gst_alsasink_class_init), (gst_alsasink_init),
(gst_alsasink_write), (gst_alsasink_reset):
* ext/alsa/gstalsasink.h:
Add lock to protect alsa calls.
Implement reset to flush samples ASAP, does not work
with dmix though.
2006-02-03 12:51:47 +00:00
Thomas Vander Stichele
5f83aa7dfa expand tabs
Original commit message from CVS:
expand tabs
2005-12-06 19:42:02 +00:00
Andy Wingo
276f6fe559 ext/: ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek) (gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain) ext...
Original commit message from CVS:
2005-05-09  Andy Wingo  <wingo@pobox.com>

* ext/alsa/gstalsasink.h:
* ext/gnomevfs/gstgnomevfssrc.c:
(gst_gnomevfssrc_get_icy_metadata):
* ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek)
(gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain)
* ext/theora/theoradec.c (theora_dec_src_query)
(theora_dec_src_event, theora_dec_sink_event)
(theora_handle_comment_packet, theora_handle_data_packet):
* ext/theora/theoraenc.c (theora_enc_chain):
* ext/vorbis/vorbisdec.c (vorbis_dec_src_event)
(vorbis_dec_sink_event, vorbis_handle_comment_packet):
* gst/audioconvert/gstaudioconvert.c (gst_audio_convert_getcaps):
* gst/typefind/gsttypefindfunctions.c (mp3_type_find)
(qt_type_find):
* gst/videotestsrc/videotestsrc.c (paint_setup_I420)
(paint_setup_YV12, paint_setup_YUY2, paint_setup_UYVY)
(paint_setup_YVYU, paint_setup_IYU2, paint_setup_Y41B)
(paint_setup_Y42B, paint_setup_Y800, paint_setup_IMC1)
(paint_setup_IMC2, paint_setup_IMC3, paint_setup_IMC4)
(paint_setup_YVU9, paint_setup_YUV9, paint_setup_xRGB8888)
(paint_setup_xBGR8888, paint_setup_RGBx8888)
(paint_setup_BGRx8888, paint_setup_RGB888, paint_setup_BGR888)
(paint_setup_RGB565, paint_setup_xRGB1555):
* gst/videotestsrc/videotestsrc.h:
* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c (gst_xvimagesink_get_xv_support)
(gst_xvimagesink_setcaps, gst_xvimagesink_buffer_alloc):
GCC4 fixes.

* ext/ogg/gstoggdemux.c (gst_ogg_demux_find_chains): Use the new
gst_pad_query_position. Fixes oggdemux.
2005-05-09 07:03:13 +00:00
Christian Schaller
ea9531ab70 fix build so you can make dist and create rpms
Original commit message from CVS:
fix build so you can make dist and create rpms
2005-05-05 15:06:40 +00:00
Wim Taymans
851547e321 ext/alsa/: Implement alsasink with simple open/write/close API.
Original commit message from CVS:
* ext/alsa/Makefile.am:
* ext/alsa/gstalsa.c: (gst_alsa_init), (gst_alsa_get_caps),
(gst_alsa_fixate_to_mimetype), (gst_alsa_fixate_field_nearest_int),
(gst_alsa_link), (gst_alsa_close_audio):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/alsa/gstalsasink.c: (gst_alsasink_get_type),
(gst_alsasink_dispose), (gst_alsasink_base_init),
(gst_alsasink_class_init), (gst_alsasink_init),
(gst_alsasink_getcaps), (set_hwparams), (set_swparams),
(alsasink_parse_spec), (gst_alsasink_open), (gst_alsasink_close),
(xrun_recovery), (gst_alsasink_write), (gst_alsasink_delay),
(gst_alsasink_reset):
* ext/alsa/gstalsasink.h:
Implement alsasink with simple open/write/close API.
Make alsa dir build by disabling compilation of code.
2005-04-28 16:19:06 +00:00
Thomas Vander Stichele
253c4e7267 ext/alsa/: - add debugging info
Original commit message from CVS:
* ext/alsa/gstalsa.c: (gst_alsa_drain_audio):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_flush_one_pad),
(gst_alsa_sink_check_event), (gst_alsa_sink_mmap),
(gst_alsa_sink_write), (gst_alsa_sink_loop):
* ext/alsa/gstalsasink.h:
- add debugging info
- clean up schizophrenia of data/buffer/event
- fix double event unref error
2004-07-08 13:40:37 +00:00
Ronald S. Bultje
7fa3cd3b18 ext/alsa/: Make alsasink/src a subclass of alsamixer so that mixer stuff shows up in gst-rec. Needs some finetuning.
Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_type),
(gst_alsa_sink_class_init):
* ext/alsa/gstalsasink.h:
* ext/alsa/gstalsasrc.c: (gst_alsa_src_get_type),
(gst_alsa_src_class_init):
* ext/alsa/gstalsasrc.h:
Make alsasink/src a subclass of alsamixer so that mixer stuff
shows up in gst-rec. Needs some finetuning.
2004-05-07 04:56:56 +00:00
Johan Dahlin
bf07c7cc9b *.h: Revert indenting
Original commit message from CVS:
* *.h: Revert indenting
2004-03-15 16:32:55 +00:00
Thomas Vander Stichele
4df3f18839 gst-indent
Original commit message from CVS:
gst-indent
2004-03-14 22:34:34 +00:00
Leif Johnson
f3b328da39 splitting ALSA code into separate source files
Original commit message from CVS:
splitting ALSA code into separate source files
2003-11-16 00:40:01 +00:00