diff --git a/libavdevice/alsa.c b/libavdevice/alsa.c index 9d8239c962..966eea519a 100644 --- a/libavdevice/alsa.c +++ b/libavdevice/alsa.c @@ -383,8 +383,10 @@ int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stre ret = AVERROR(ENOMEM); goto fail; } - new_device->device_name = av_strdup(name); - if ((tmp = strrchr(descr, '\n')) && tmp[1]) + new_device->device_name = av_strdup(name ? name : ""); + if (!descr) + new_device->device_description = av_strdup(""); + else if ((tmp = strrchr(descr, '\n')) && tmp[1]) new_device->device_description = av_strdup(&tmp[1]); else new_device->device_description = av_strdup(descr); diff --git a/tests/fate/libavdevice.mak b/tests/fate/libavdevice.mak index e983327a50..3ccbf0731d 100644 --- a/tests/fate/libavdevice.mak +++ b/tests/fate/libavdevice.mak @@ -2,5 +2,13 @@ FATE_LIBAVDEVICE-$(CONFIG_JACK_INDEV) += fate-timefilter fate-timefilter: libavdevice/tests/timefilter$(EXESUF) fate-timefilter: CMD = run libavdevice/tests/timefilter +tests/data/alsa_nodesc.conf: | tests/data + $(Q)printf 'pcm.nodesc {\n\ttype null\n\thint {\n\t\tshow on\n\t}\n}\n' > $@ + +FATE_FFMPEG-$(CONFIG_ALSA_INDEV) += fate-alsa-device-list-nodesc +fate-alsa-device-list-nodesc: tests/data/alsa_nodesc.conf +fate-alsa-device-list-nodesc: CMD = (export ALSA_CONFIG_PATH=$(TARGET_PATH)/tests/data/alsa_nodesc.conf && ffmpeg -sources alsa) +fate-alsa-device-list-nodesc: CMP = null + FATE-$(CONFIG_AVDEVICE) += $(FATE_LIBAVDEVICE-yes) fate-libavdevice: $(FATE_LIBAVDEVICE-yes)