diff --git a/cmvr-es/devices/microphone/ffmpeg_microphone/src/microphone_device_discovery.cpp b/cmvr-es/devices/microphone/ffmpeg_microphone/src/microphone_device_discovery.cpp index 99fa3adc..df7f9e7b 100644 --- a/cmvr-es/devices/microphone/ffmpeg_microphone/src/microphone_device_discovery.cpp +++ b/cmvr-es/devices/microphone/ffmpeg_microphone/src/microphone_device_discovery.cpp @@ -2,6 +2,7 @@ #include #include +#include #include extern "C" { @@ -26,6 +27,17 @@ struct DeviceListDeleter { } }; +bool isFfmpegCaptureEndpoint(const char* device_name) +{ + constexpr std::string_view kPlugHardwarePrefix = "plughw:"; + if (!device_name) { + return false; + } + + const std::string_view name(device_name); + return name.compare(0, kPlugHardwarePrefix.size(), kPlugHardwarePrefix) == 0; +} + } // namespace std::vector listAvailableMicrophoneInputDevices() @@ -55,7 +67,7 @@ std::vector listAvailableMicrophoneInputDevices() for (int index = 0; index < device_list->nb_devices; ++index) { const AVDeviceInfo* source = device_list->devices[index]; - if (!source || !source->device_name || source->device_name[0] == '\0') { + if (!source || !isFfmpegCaptureEndpoint(source->device_name)) { continue; }