From 662c557cc2b997748c4ef33dcb269613d16e613e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 9 Feb 2007 09:58:28 +0000 Subject: [PATCH] ext/alsa/gstalsa.c: Try to get devic-name from device string first, and from handle only as fallback (seems to yield ... Original commit message from CVS: * ext/alsa/gstalsa.c: (gst_alsa_find_device_name): Try to get devic-name from device string first, and from handle only as fallback (seems to yield better results and is more robust against buggy probing code on the application side). --- ChangeLog | 7 +++++++ ext/alsa/gstalsa.c | 22 +++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47414a3c04..c6a7dc711f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-02-09 Tim-Philipp Müller + + * ext/alsa/gstalsa.c: (gst_alsa_find_device_name): + Try to get devic-name from device string first, and from handle only + as fallback (seems to yield better results and is more robust + against buggy probing code on the application side). + 2007-02-08 Tim-Philipp Müller Based on patch by: Julien Puydt diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index 7653475fea..5d7f1ef831 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -451,17 +451,7 @@ gst_alsa_find_device_name (GstObject * obj, const gchar * device, { gchar *ret = NULL; - if (handle != NULL) { - snd_pcm_info_t *info; - - GST_LOG_OBJECT (obj, "Trying to get device name from open handle"); - snd_pcm_info_malloc (&info); - snd_pcm_info (handle, info); - ret = g_strdup (snd_pcm_info_get_name (info)); - snd_pcm_info_free (info); - } - - if (ret == NULL && device != NULL) { + if (device != NULL) { gchar *dev, *comma; gint devnum; @@ -477,6 +467,16 @@ gst_alsa_find_device_name (GstObject * obj, const gchar * device, g_free (dev); } + if (ret == NULL && handle != NULL) { + snd_pcm_info_t *info; + + GST_LOG_OBJECT (obj, "Trying to get device name from open handle"); + snd_pcm_info_malloc (&info); + snd_pcm_info (handle, info); + ret = g_strdup (snd_pcm_info_get_name (info)); + snd_pcm_info_free (info); + } + GST_LOG_OBJECT (obj, "Device name for device '%s': %s", GST_STR_NULL (device), GST_STR_NULL (ret));