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:
@@ -111,13 +111,12 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
void **hints, **n;
|
void **hints, **n;
|
||||||
int card = -1;
|
if (snd_device_name_hint(-1, "pcm", &hints) < 0) {
|
||||||
|
qWarning()<<"no alsa devices available";
|
||||||
while (snd_card_next(&card) == 0 && card >= 0) {
|
return;
|
||||||
if (snd_device_name_hint(card, "pcm", &hints) < 0)
|
}
|
||||||
continue;
|
|
||||||
|
|
||||||
n = hints;
|
n = hints;
|
||||||
|
|
||||||
while (*n != NULL) {
|
while (*n != NULL) {
|
||||||
char *name = snd_device_name_get_hint(*n, "NAME");
|
char *name = snd_device_name_get_hint(*n, "NAME");
|
||||||
char *descr = snd_device_name_get_hint(*n, "DESC");
|
char *descr = snd_device_name_get_hint(*n, "DESC");
|
||||||
@@ -136,11 +135,9 @@ void QGstreamerAudioInputSelector::updateAlsaDevices()
|
|||||||
free(descr);
|
free(descr);
|
||||||
if (io != NULL)
|
if (io != NULL)
|
||||||
free(io);
|
free(io);
|
||||||
++n;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_device_name_free_hint(hints);
|
snd_device_name_free_hint(hints);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -337,9 +337,14 @@ QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
|
|||||||
|
|
||||||
#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
|
#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
|
||||||
// Create a list of all current audio devices that support mode
|
// Create a list of all current audio devices that support mode
|
||||||
void **hints;
|
void **hints, **n;
|
||||||
char *name, *descr, *io;
|
char *name, *descr, *io;
|
||||||
int card = -1;
|
|
||||||
|
if(snd_device_name_hint(-1, "pcm", &hints) < 0) {
|
||||||
|
qWarning() << "no alsa devices available";
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
n = hints;
|
||||||
|
|
||||||
if(mode == QAudio::AudioInput) {
|
if(mode == QAudio::AudioInput) {
|
||||||
filter = "Input";
|
filter = "Input";
|
||||||
@@ -347,11 +352,6 @@ QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
|
|||||||
filter = "Output";
|
filter = "Output";
|
||||||
}
|
}
|
||||||
|
|
||||||
while (snd_card_next(&card) == 0 && card >= 0) {
|
|
||||||
if (snd_device_name_hint(card, "pcm", &hints) < 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
void **n = hints;
|
|
||||||
while (*n != NULL) {
|
while (*n != NULL) {
|
||||||
name = snd_device_name_get_hint(*n, "NAME");
|
name = snd_device_name_get_hint(*n, "NAME");
|
||||||
if (name != 0 && qstrcmp(name, "null") != 0) {
|
if (name != 0 && qstrcmp(name, "null") != 0) {
|
||||||
@@ -373,9 +373,7 @@ QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
|
|||||||
free(name);
|
free(name);
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_device_name_free_hint(hints);
|
snd_device_name_free_hint(hints);
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
char* name;
|
char* name;
|
||||||
@@ -416,15 +414,14 @@ void QAlsaAudioDeviceInfo::checkSurround()
|
|||||||
surround51 = false;
|
surround51 = false;
|
||||||
surround71 = false;
|
surround71 = false;
|
||||||
|
|
||||||
void **hints;
|
void **hints, **n;
|
||||||
char *name, *descr, *io;
|
char *name, *descr, *io;
|
||||||
int card = -1;
|
|
||||||
|
|
||||||
while (snd_card_next(&card) == 0 && card >= 0) {
|
if(snd_device_name_hint(-1, "pcm", &hints) < 0)
|
||||||
if (snd_device_name_hint(card, "pcm", &hints) < 0)
|
return;
|
||||||
continue;
|
|
||||||
|
n = hints;
|
||||||
|
|
||||||
void **n = hints;
|
|
||||||
while (*n != NULL) {
|
while (*n != NULL) {
|
||||||
name = snd_device_name_get_hint(*n, "NAME");
|
name = snd_device_name_get_hint(*n, "NAME");
|
||||||
descr = snd_device_name_get_hint(*n, "DESC");
|
descr = snd_device_name_get_hint(*n, "DESC");
|
||||||
@@ -448,9 +445,7 @@ void QAlsaAudioDeviceInfo::checkSurround()
|
|||||||
free(io);
|
free(io);
|
||||||
++n;
|
++n;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_device_name_free_hint(hints);
|
snd_device_name_free_hint(hints);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
Reference in New Issue
Block a user