2 * Copyright (C) 2005 Wim Taymans <wim@fluendo.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * SECTION:element-alsasrc
24 * @see_also: alsasink, alsamixer
26 * This element reads data from an audio card using the ALSA API.
29 * <title>Example pipelines</title>
31 * gst-launch -v alsasrc ! audioconvert ! vorbisenc ! oggmux ! filesink location=alsasrc.ogg
32 * ]| Record from a sound card using ALSA and encode to Ogg/Vorbis.
35 * Last reviewed on 2006-03-01 (0.10.4)
41 #include <sys/ioctl.h>
47 #include <alsa/asoundlib.h>
49 #include "gstalsasrc.h"
50 #include "gstalsadeviceprobe.h"
52 #include <gst/gst-i18n-plugin.h>
54 #define DEFAULT_PROP_DEVICE "default"
55 #define DEFAULT_PROP_DEVICE_NAME ""
64 static void gst_alsasrc_init_interfaces (GType type);
66 GST_BOILERPLATE_FULL (GstAlsaSrc, gst_alsasrc, GstAudioSrc,
67 GST_TYPE_AUDIO_SRC, gst_alsasrc_init_interfaces);
69 GST_IMPLEMENT_ALSA_MIXER_METHODS (GstAlsaSrc, gst_alsasrc_mixer);
71 static void gst_alsasrc_finalize (GObject * object);
72 static void gst_alsasrc_set_property (GObject * object,
73 guint prop_id, const GValue * value, GParamSpec * pspec);
74 static void gst_alsasrc_get_property (GObject * object,
75 guint prop_id, GValue * value, GParamSpec * pspec);
77 static GstCaps *gst_alsasrc_getcaps (GstBaseSrc * bsrc);
79 static gboolean gst_alsasrc_open (GstAudioSrc * asrc);
80 static gboolean gst_alsasrc_prepare (GstAudioSrc * asrc,
81 GstRingBufferSpec * spec);
82 static gboolean gst_alsasrc_unprepare (GstAudioSrc * asrc);
83 static gboolean gst_alsasrc_close (GstAudioSrc * asrc);
84 static guint gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length);
85 static guint gst_alsasrc_delay (GstAudioSrc * asrc);
86 static void gst_alsasrc_reset (GstAudioSrc * asrc);
88 /* AlsaSrc signals and args */
94 #if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
95 # define ALSA_SRC_FACTORY_ENDIANNESS "LITTLE_ENDIAN, BIG_ENDIAN"
97 # define ALSA_SRC_FACTORY_ENDIANNESS "BIG_ENDIAN, LITTLE_ENDIAN"
100 static GstStaticPadTemplate alsasrc_src_factory =
101 GST_STATIC_PAD_TEMPLATE ("src",
104 GST_STATIC_CAPS ("audio/x-raw-int, "
105 "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
106 "signed = (boolean) { TRUE, FALSE }, "
109 "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
111 "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
112 "signed = (boolean) { TRUE, FALSE }, "
115 "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
117 "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
118 "signed = (boolean) { TRUE, FALSE }, "
121 "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
123 "endianness = (int) { " ALSA_SRC_FACTORY_ENDIANNESS " }, "
124 "signed = (boolean) { TRUE, FALSE }, "
127 "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]; "
129 "signed = (boolean) { TRUE, FALSE }, "
132 "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
136 gst_alsasrc_finalize (GObject * object)
138 GstAlsaSrc *src = GST_ALSA_SRC (object);
140 g_free (src->device);
141 g_mutex_free (src->alsa_lock);
143 G_OBJECT_CLASS (parent_class)->finalize (object);
147 gst_alsasrc_interface_supported (GstAlsaSrc * this, GType interface_type)
149 /* only support this one interface (wrapped by GstImplementsInterface) */
150 g_assert (interface_type == GST_TYPE_MIXER);
152 return gst_alsasrc_mixer_supported (this, interface_type);
156 gst_implements_interface_init (GstImplementsInterfaceClass * klass)
158 klass->supported = (gpointer) gst_alsasrc_interface_supported;
162 gst_alsasrc_init_interfaces (GType type)
164 static const GInterfaceInfo implements_iface_info = {
165 (GInterfaceInitFunc) gst_implements_interface_init,
169 static const GInterfaceInfo mixer_iface_info = {
170 (GInterfaceInitFunc) gst_alsasrc_mixer_interface_init,
175 g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE,
176 &implements_iface_info);
177 g_type_add_interface_static (type, GST_TYPE_MIXER, &mixer_iface_info);
179 gst_alsa_type_add_device_property_probe_interface (type);
183 gst_alsasrc_base_init (gpointer g_class)
185 GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
187 gst_element_class_set_details_simple (element_class,
188 "Audio source (ALSA)", "Source/Audio",
189 "Read from a sound card via ALSA", "Wim Taymans <wim@fluendo.com>");
191 gst_element_class_add_pad_template (element_class,
192 gst_static_pad_template_get (&alsasrc_src_factory));
196 gst_alsasrc_class_init (GstAlsaSrcClass * klass)
198 GObjectClass *gobject_class;
199 GstBaseSrcClass *gstbasesrc_class;
200 GstAudioSrcClass *gstaudiosrc_class;
202 gobject_class = (GObjectClass *) klass;
203 gstbasesrc_class = (GstBaseSrcClass *) klass;
204 gstaudiosrc_class = (GstAudioSrcClass *) klass;
206 gobject_class->finalize = gst_alsasrc_finalize;
207 gobject_class->get_property = gst_alsasrc_get_property;
208 gobject_class->set_property = gst_alsasrc_set_property;
210 gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_alsasrc_getcaps);
212 gstaudiosrc_class->open = GST_DEBUG_FUNCPTR (gst_alsasrc_open);
213 gstaudiosrc_class->prepare = GST_DEBUG_FUNCPTR (gst_alsasrc_prepare);
214 gstaudiosrc_class->unprepare = GST_DEBUG_FUNCPTR (gst_alsasrc_unprepare);
215 gstaudiosrc_class->close = GST_DEBUG_FUNCPTR (gst_alsasrc_close);
216 gstaudiosrc_class->read = GST_DEBUG_FUNCPTR (gst_alsasrc_read);
217 gstaudiosrc_class->delay = GST_DEBUG_FUNCPTR (gst_alsasrc_delay);
218 gstaudiosrc_class->reset = GST_DEBUG_FUNCPTR (gst_alsasrc_reset);
220 g_object_class_install_property (gobject_class, PROP_DEVICE,
221 g_param_spec_string ("device", "Device",
222 "ALSA device, as defined in an asound configuration file",
223 DEFAULT_PROP_DEVICE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
225 g_object_class_install_property (gobject_class, PROP_DEVICE_NAME,
226 g_param_spec_string ("device-name", "Device name",
227 "Human-readable name of the sound device",
228 DEFAULT_PROP_DEVICE_NAME, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
232 gst_alsasrc_set_property (GObject * object, guint prop_id,
233 const GValue * value, GParamSpec * pspec)
237 src = GST_ALSA_SRC (object);
241 g_free (src->device);
242 src->device = g_value_dup_string (value);
243 if (src->device == NULL) {
244 src->device = g_strdup (DEFAULT_PROP_DEVICE);
248 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
254 gst_alsasrc_get_property (GObject * object, guint prop_id,
255 GValue * value, GParamSpec * pspec)
259 src = GST_ALSA_SRC (object);
263 g_value_set_string (value, src->device);
265 case PROP_DEVICE_NAME:
266 g_value_take_string (value,
267 gst_alsa_find_device_name (GST_OBJECT_CAST (src),
268 src->device, src->handle, SND_PCM_STREAM_CAPTURE));
271 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
277 gst_alsasrc_init (GstAlsaSrc * alsasrc, GstAlsaSrcClass * g_class)
279 GST_DEBUG_OBJECT (alsasrc, "initializing");
281 alsasrc->device = g_strdup (DEFAULT_PROP_DEVICE);
282 alsasrc->cached_caps = NULL;
284 alsasrc->alsa_lock = g_mutex_new ();
287 #define CHECK(call, error) \
289 if ((err = call) < 0) \
295 gst_alsasrc_getcaps (GstBaseSrc * bsrc)
297 GstElementClass *element_class;
298 GstPadTemplate *pad_template;
302 src = GST_ALSA_SRC (bsrc);
304 if (src->handle == NULL) {
305 GST_DEBUG_OBJECT (src, "device not open, using template caps");
306 return NULL; /* base class will get template caps for us */
309 if (src->cached_caps) {
310 GST_LOG_OBJECT (src, "Returning cached caps");
311 return gst_caps_ref (src->cached_caps);
314 element_class = GST_ELEMENT_GET_CLASS (src);
315 pad_template = gst_element_class_get_pad_template (element_class, "src");
316 g_return_val_if_fail (pad_template != NULL, NULL);
318 caps = gst_alsa_probe_supported_formats (GST_OBJECT (src), src->handle,
319 gst_pad_template_get_caps (pad_template));
322 src->cached_caps = gst_caps_ref (caps);
325 GST_INFO_OBJECT (src, "returning caps %" GST_PTR_FORMAT, caps);
331 set_hwparams (GstAlsaSrc * alsa)
335 snd_pcm_hw_params_t *params;
337 snd_pcm_hw_params_malloc (¶ms);
339 /* choose all parameters */
340 CHECK (snd_pcm_hw_params_any (alsa->handle, params), no_config);
341 /* set the interleaved read/write format */
342 CHECK (snd_pcm_hw_params_set_access (alsa->handle, params, alsa->access),
344 /* set the sample format */
345 CHECK (snd_pcm_hw_params_set_format (alsa->handle, params, alsa->format),
347 /* set the count of channels */
348 CHECK (snd_pcm_hw_params_set_channels (alsa->handle, params, alsa->channels),
350 /* set the stream rate */
352 CHECK (snd_pcm_hw_params_set_rate_near (alsa->handle, params, &rrate, NULL),
354 if (rrate != alsa->rate)
357 if (alsa->buffer_time != -1) {
358 /* set the buffer time */
359 CHECK (snd_pcm_hw_params_set_buffer_time_near (alsa->handle, params,
360 &alsa->buffer_time, NULL), buffer_time);
362 if (alsa->period_time != -1) {
363 /* set the period time */
364 CHECK (snd_pcm_hw_params_set_period_time_near (alsa->handle, params,
365 &alsa->period_time, NULL), period_time);
368 /* write the parameters to device */
369 CHECK (snd_pcm_hw_params (alsa->handle, params), set_hw_params);
371 CHECK (snd_pcm_hw_params_get_buffer_size (params, &alsa->buffer_size),
374 CHECK (snd_pcm_hw_params_get_period_size (params, &alsa->period_size, NULL),
377 snd_pcm_hw_params_free (params);
383 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
384 ("Broken configuration for recording: no configurations available: %s",
385 snd_strerror (err)));
386 snd_pcm_hw_params_free (params);
391 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
392 ("Access type not available for recording: %s", snd_strerror (err)));
393 snd_pcm_hw_params_free (params);
398 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
399 ("Sample format not available for recording: %s", snd_strerror (err)));
400 snd_pcm_hw_params_free (params);
407 if ((alsa->channels) == 1)
408 msg = g_strdup (_("Could not open device for recording in mono mode."));
409 if ((alsa->channels) == 2)
410 msg = g_strdup (_("Could not open device for recording in stereo mode."));
411 if ((alsa->channels) > 2)
414 ("Could not open device for recording in %d-channel mode"),
416 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, ("%s", msg),
417 ("%s", snd_strerror (err)));
419 snd_pcm_hw_params_free (params);
424 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
425 ("Rate %iHz not available for recording: %s",
426 alsa->rate, snd_strerror (err)));
427 snd_pcm_hw_params_free (params);
432 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
433 ("Rate doesn't match (requested %iHz, get %iHz)", alsa->rate, err));
434 snd_pcm_hw_params_free (params);
439 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
440 ("Unable to set buffer time %i for recording: %s",
441 alsa->buffer_time, snd_strerror (err)));
442 snd_pcm_hw_params_free (params);
447 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
448 ("Unable to get buffer size for recording: %s", snd_strerror (err)));
449 snd_pcm_hw_params_free (params);
454 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
455 ("Unable to set period time %i for recording: %s", alsa->period_time,
456 snd_strerror (err)));
457 snd_pcm_hw_params_free (params);
462 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
463 ("Unable to get period size for recording: %s", snd_strerror (err)));
464 snd_pcm_hw_params_free (params);
469 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
470 ("Unable to set hw params for recording: %s", snd_strerror (err)));
471 snd_pcm_hw_params_free (params);
477 set_swparams (GstAlsaSrc * alsa)
480 snd_pcm_sw_params_t *params;
482 snd_pcm_sw_params_malloc (¶ms);
484 /* get the current swparams */
485 CHECK (snd_pcm_sw_params_current (alsa->handle, params), no_config);
486 /* allow the transfer when at least period_size samples can be processed */
487 CHECK (snd_pcm_sw_params_set_avail_min (alsa->handle, params,
488 alsa->period_size), set_avail);
489 /* start the transfer on first read */
490 CHECK (snd_pcm_sw_params_set_start_threshold (alsa->handle, params,
491 0), start_threshold);
493 #if GST_CHECK_ALSA_VERSION(1,0,16)
494 /* snd_pcm_sw_params_set_xfer_align() is deprecated, alignment is always 1 */
496 /* align all transfers to 1 sample */
497 CHECK (snd_pcm_sw_params_set_xfer_align (alsa->handle, params, 1), set_align);
500 /* write the parameters to the recording device */
501 CHECK (snd_pcm_sw_params (alsa->handle, params), set_sw_params);
503 snd_pcm_sw_params_free (params);
509 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
510 ("Unable to determine current swparams for playback: %s",
511 snd_strerror (err)));
512 snd_pcm_sw_params_free (params);
517 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
518 ("Unable to set start threshold mode for playback: %s",
519 snd_strerror (err)));
520 snd_pcm_sw_params_free (params);
525 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
526 ("Unable to set avail min for playback: %s", snd_strerror (err)));
527 snd_pcm_sw_params_free (params);
530 #if !GST_CHECK_ALSA_VERSION(1,0,16)
533 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
534 ("Unable to set transfer align for playback: %s", snd_strerror (err)));
535 snd_pcm_sw_params_free (params);
541 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
542 ("Unable to set sw params for playback: %s", snd_strerror (err)));
543 snd_pcm_sw_params_free (params);
549 alsasrc_parse_spec (GstAlsaSrc * alsa, GstRingBufferSpec * spec)
551 switch (spec->type) {
552 case GST_BUFTYPE_LINEAR:
553 alsa->format = snd_pcm_build_linear_format (spec->depth, spec->width,
554 spec->sign ? 0 : 1, spec->bigend ? 1 : 0);
556 case GST_BUFTYPE_FLOAT:
557 switch (spec->format) {
559 alsa->format = SND_PCM_FORMAT_FLOAT_LE;
562 alsa->format = SND_PCM_FORMAT_FLOAT_BE;
565 alsa->format = SND_PCM_FORMAT_FLOAT64_LE;
568 alsa->format = SND_PCM_FORMAT_FLOAT64_BE;
574 case GST_BUFTYPE_A_LAW:
575 alsa->format = SND_PCM_FORMAT_A_LAW;
577 case GST_BUFTYPE_MU_LAW:
578 alsa->format = SND_PCM_FORMAT_MU_LAW;
584 alsa->rate = spec->rate;
585 alsa->channels = spec->channels;
586 alsa->buffer_time = spec->buffer_time;
587 alsa->period_time = spec->latency_time;
588 alsa->access = SND_PCM_ACCESS_RW_INTERLEAVED;
600 gst_alsasrc_open (GstAudioSrc * asrc)
605 alsa = GST_ALSA_SRC (asrc);
607 CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_CAPTURE,
608 SND_PCM_NONBLOCK), open_error);
611 alsa->mixer = gst_alsa_mixer_new (alsa->device, GST_ALSA_MIXER_CAPTURE);
619 GST_ELEMENT_ERROR (alsa, RESOURCE, BUSY,
620 (_("Could not open audio device for recording. "
621 "Device is being used by another application.")),
622 ("Device '%s' is busy", alsa->device));
624 GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
625 (_("Could not open audio device for recording.")),
626 ("Recording open error on device '%s': %s", alsa->device,
627 snd_strerror (err)));
634 gst_alsasrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
639 alsa = GST_ALSA_SRC (asrc);
641 if (!alsasrc_parse_spec (alsa, spec))
644 CHECK (snd_pcm_nonblock (alsa->handle, 0), non_block);
646 CHECK (set_hwparams (alsa), hw_params_failed);
647 CHECK (set_swparams (alsa), sw_params_failed);
648 CHECK (snd_pcm_prepare (alsa->handle), prepare_failed);
650 alsa->bytes_per_sample = spec->bytes_per_sample;
651 spec->segsize = alsa->period_size * spec->bytes_per_sample;
652 spec->segtotal = alsa->buffer_size / alsa->period_size;
653 spec->silence_sample[0] = 0;
654 spec->silence_sample[1] = 0;
655 spec->silence_sample[2] = 0;
656 spec->silence_sample[3] = 0;
663 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
664 ("Error parsing spec"));
669 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
670 ("Could not set device to blocking: %s", snd_strerror (err)));
675 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
676 ("Setting of hwparams failed: %s", snd_strerror (err)));
681 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
682 ("Setting of swparams failed: %s", snd_strerror (err)));
687 GST_ELEMENT_ERROR (alsa, RESOURCE, SETTINGS, (NULL),
688 ("Prepare failed: %s", snd_strerror (err)));
694 gst_alsasrc_unprepare (GstAudioSrc * asrc)
698 alsa = GST_ALSA_SRC (asrc);
700 snd_pcm_drop (alsa->handle);
701 snd_pcm_hw_free (alsa->handle);
702 snd_pcm_nonblock (alsa->handle, 1);
708 gst_alsasrc_close (GstAudioSrc * asrc)
710 GstAlsaSrc *alsa = GST_ALSA_SRC (asrc);
712 snd_pcm_close (alsa->handle);
716 gst_alsa_mixer_free (alsa->mixer);
720 gst_caps_replace (&alsa->cached_caps, NULL);
726 * Underrun and suspend recovery
729 xrun_recovery (GstAlsaSrc * alsa, snd_pcm_t * handle, gint err)
731 GST_DEBUG_OBJECT (alsa, "xrun recovery %d", err);
733 if (err == -EPIPE) { /* under-run */
734 err = snd_pcm_prepare (handle);
736 GST_WARNING_OBJECT (alsa,
737 "Can't recovery from underrun, prepare failed: %s",
740 } else if (err == -ESTRPIPE) {
741 while ((err = snd_pcm_resume (handle)) == -EAGAIN)
742 g_usleep (100); /* wait until the suspend flag is released */
745 err = snd_pcm_prepare (handle);
747 GST_WARNING_OBJECT (alsa,
748 "Can't recovery from suspend, prepare failed: %s",
757 gst_alsasrc_read (GstAudioSrc * asrc, gpointer data, guint length)
764 alsa = GST_ALSA_SRC (asrc);
766 cptr = length / alsa->bytes_per_sample;
769 GST_ALSA_SRC_LOCK (asrc);
771 if ((err = snd_pcm_readi (alsa->handle, ptr, cptr)) < 0) {
772 if (err == -EAGAIN) {
773 GST_DEBUG_OBJECT (asrc, "Read error: %s", snd_strerror (err));
775 } else if (xrun_recovery (alsa, alsa->handle, err) < 0) {
781 ptr += err * alsa->channels;
784 GST_ALSA_SRC_UNLOCK (asrc);
786 return length - (cptr * alsa->bytes_per_sample);
790 GST_ALSA_SRC_UNLOCK (asrc);
791 return length; /* skip one period */
796 gst_alsasrc_delay (GstAudioSrc * asrc)
799 snd_pcm_sframes_t delay;
802 alsa = GST_ALSA_SRC (asrc);
804 res = snd_pcm_delay (alsa->handle, &delay);
805 if (G_UNLIKELY (res < 0)) {
806 GST_DEBUG_OBJECT (alsa, "snd_pcm_delay returned %d", res);
810 return CLAMP (delay, 0, alsa->buffer_size);
814 gst_alsasrc_reset (GstAudioSrc * asrc)
819 alsa = GST_ALSA_SRC (asrc);
821 GST_ALSA_SRC_LOCK (asrc);
822 GST_DEBUG_OBJECT (alsa, "drop");
823 CHECK (snd_pcm_drop (alsa->handle), drop_error);
824 GST_DEBUG_OBJECT (alsa, "prepare");
825 CHECK (snd_pcm_prepare (alsa->handle), prepare_error);
826 GST_DEBUG_OBJECT (alsa, "reset done");
827 GST_ALSA_SRC_UNLOCK (asrc);
834 GST_ERROR_OBJECT (alsa, "alsa-reset: pcm drop error: %s",
836 GST_ALSA_SRC_UNLOCK (asrc);
841 GST_ERROR_OBJECT (alsa, "alsa-reset: pcm prepare error: %s",
843 GST_ALSA_SRC_UNLOCK (asrc);