Revert "Alsa: fix crash when detecting devices."

This reverts commit 0ab81ef59f.
The workaround causes software devices not to appear in the list
of available devices. Besides, since the crash is caused by a bug
in older versions of Alsa, the workaround was probably a bad idea
in the first place. People should update Alsa instead.

Task-number: QTBUG-42326
Change-Id: I37923a87180d1c5abc18d52d84f633e14ba46860
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
Yoann Lopes
2015-03-11 14:32:17 +01:00
parent 95e9155b7f
commit e1d76e2df5
2 changed files with 72 additions and 80 deletions

View File

@@ -111,36 +111,33 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
{
#ifdef HAVE_ALSA
void **hints, **n;
int card = -1;
if (snd_device_name_hint(-1, "pcm", &hints) < 0) {
qWarning()<<"no alsa devices available";
return;
}
n = hints;
while (snd_card_next(&card) == 0 && card >= 0) {
if (snd_device_name_hint(card, "pcm", &hints) < 0)
continue;
while (*n != NULL) {
char *name = snd_device_name_get_hint(*n, "NAME");
char *descr = snd_device_name_get_hint(*n, "DESC");
char *io = snd_device_name_get_hint(*n, "IOID");
n = hints;
while (*n != NULL) {
char *name = snd_device_name_get_hint(*n, "NAME");
char *descr = snd_device_name_get_hint(*n, "DESC");
char *io = snd_device_name_get_hint(*n, "IOID");
if ((name != NULL) && (descr != NULL)) {
if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
m_descriptions.append(QString::fromUtf8(descr));
}
if ((name != NULL) && (descr != NULL)) {
if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
m_descriptions.append(QString::fromUtf8(descr));
}
if (name != NULL)
free(name);
if (descr != NULL)
free(descr);
if (io != NULL)
free(io);
++n;
}
snd_device_name_free_hint(hints);
if (name != NULL)
free(name);
if (descr != NULL)
free(descr);
if (io != NULL)
free(io);
n++;
}
snd_device_name_free_hint(hints);
#endif
}