Skip to content

Commit 48a96b1

Browse files
committed
[MediaCapabilities][GStreamer] Check audio codecs support isConfigurationSupported()
https://bugs.webkit.org/show_bug.cgi?id=310195 Reviewed by NOBODY (OOPS!). Currently, isConfigurationSupported() only validates video codecs against the registered decoder/encoder map. Audio codecs from the audio configuration were never checked, so unsupported audio codecs could incorrectly be reported as supported. See: WebPlatformForEmbedded/WPEWebKit#1640 Fix this by collecting codec strings from both the video and audio ContentType objects into a single vector and running the software codec support checks once on the combined list at the end of the function. Audio hardware accelerated decoding doesn't save much CPU power compared to video accelerated decoding, and we don't want to reject a video+audio codec combination just because the audio part isn't accelerated. That's why the hardware accelerated decoding support checks are only run on the video codecs. Co-authored by: Andrzej Surdej (https://github.com/asurdej-comcast) * Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp: (WebCore::GStreamerRegistryScanner::isConfigurationSupported const): Collect audio codecs and run the codec checks.
1 parent 06f70da commit 48a96b1

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Source/WebCore/platform/graphics/gstreamer/GStreamerRegistryScanner.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,11 +1030,13 @@ ASCIILiteral GStreamerRegistryScanner::configurationNameForLogging(Configuration
10301030

10311031
GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfigurationSupported(Configuration configuration, const PlatformMediaConfiguration& mediaConfiguration) const
10321032
{
1033-
bool isUsingHardware = false;
10341033
#ifndef GST_DISABLE_GST_DEBUG
10351034
ASCIILiteral configLogString = configurationNameForLogging(configuration);
10361035
#endif
10371036

1037+
Vector<String> allCodecs;
1038+
Vector<String> videoCodecs;
1039+
10381040
if (mediaConfiguration.video) {
10391041
auto& videoConfiguration = mediaConfiguration.video.value();
10401042
#ifndef GST_DISABLE_GST_DEBUG
@@ -1064,12 +1066,8 @@ GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfi
10641066
if (!isContainerTypeSupported(configuration, contentType.containerType()))
10651067
return { false, false, nullptr };
10661068

1067-
auto codecs = contentType.codecs();
1068-
if (!codecs.isEmpty()) {
1069-
if (!areAllCodecsSupported(configuration, codecs, false))
1070-
return { false, false, nullptr };
1071-
isUsingHardware = areAllCodecsSupported(configuration, codecs, true);
1072-
}
1069+
allCodecs.appendVector(contentType.codecs());
1070+
videoCodecs.appendVector(contentType.codecs());
10731071
}
10741072

10751073
if (mediaConfiguration.audio) {
@@ -1082,6 +1080,15 @@ GStreamerRegistryScanner::RegistryLookupResult GStreamerRegistryScanner::isConfi
10821080
auto contentType = ContentType(audioConfiguration.contentType);
10831081
if (!isContainerTypeSupported(configuration, contentType.containerType()))
10841082
return { false, false, nullptr };
1083+
1084+
allCodecs.appendVector(contentType.codecs());
1085+
}
1086+
1087+
bool isUsingHardware = false;
1088+
if (!allCodecs.isEmpty()) {
1089+
if (!areAllCodecsSupported(configuration, allCodecs, false))
1090+
return { false, false, nullptr };
1091+
isUsingHardware = areAllCodecsSupported(configuration, videoCodecs, true);
10851092
}
10861093

10871094
return { true, isUsingHardware, nullptr };

0 commit comments

Comments
 (0)