From a8e4be007a737b22aa11eff9267aef3afd5d791a Mon Sep 17 00:00:00 2001 From: Andrzej Surdej Date: Fri, 13 Mar 2026 16:56:53 +0100 Subject: [PATCH] [MediaCapabilities][GST] Check audio codecs support isConfigurationSupported() Previously, isConfigurationSupported() only validated video codecs against the registered decoder/encoder map; audio codecs from the audio configuration were never checked, so unsupported audio codecs would incorrectly be reported as supported. Fix this by collecting codec strings from both the video and audio ContentType objects into a single vector and running the software and hardware codec support checks once on the combined list at the end of the function. --- .../gstreamer/GStreamerRegistryScanner.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp index 837efc0941c2..fad4ebdf0cf1 100644 --- a/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp @@ -1020,11 +1020,12 @@ ASCIILiteral GStreamerRegistryScanner::configurationNameForLogging(Configuration GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfigurationSupported(Configuration configuration, const MediaConfiguration& mediaConfiguration) const { - bool isUsingHardware = false; #ifndef GST_DISABLE_GST_DEBUG ASCIILiteral configLogString = configurationNameForLogging(configuration); #endif + Vector allCodecs; + if (mediaConfiguration.video) { auto& videoConfiguration = mediaConfiguration.video.value(); #ifndef GST_DISABLE_GST_DEBUG @@ -1054,12 +1055,7 @@ GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfi if (!isContainerTypeSupported(configuration, contentType.containerType())) return { false, false, nullptr }; - auto codecs = contentType.codecs(); - if (!codecs.isEmpty()) { - if (!areAllCodecsSupported(configuration, codecs, false)) - return { false, false, nullptr }; - isUsingHardware = areAllCodecsSupported(configuration, codecs, true); - } + allCodecs.appendVector(contentType.codecs()); } if (mediaConfiguration.audio) { @@ -1072,6 +1068,15 @@ GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfi auto contentType = ContentType(audioConfiguration.contentType); if (!isContainerTypeSupported(configuration, contentType.containerType())) return { false, false, nullptr }; + + allCodecs.appendVector(contentType.codecs()); + } + + bool isUsingHardware = false; + if (!allCodecs.isEmpty()) { + if (!areAllCodecsSupported(configuration, allCodecs, false)) + return { false, false, nullptr }; + isUsingHardware = areAllCodecsSupported(configuration, allCodecs, true); } return { true, isUsingHardware, nullptr };