diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
index 749897fe9533d0dd5d1b10cf154740839b790391..b7f53137d74ac4b3a872b9bd75a3c5e2147575d8 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -379,6 +379,8 @@ int ff_alsa_get_device_list(AVDeviceInfoList *device_list, snd_pcm_stream_t stre
                                               &device_list->nb_devices, new_device)) < 0) {
                 goto fail;
             }
+            if (!strcmp(new_device->device_name, "default"))
+                device_list->default_device = device_list->nb_devices - 1;
             new_device = NULL;
         }
       fail: