Add require_encrypted config for OS software decoders.
These were inadvertently excluded after change
bbc7917ae5b676997711fa693c2b7df0246a70d4
This also fixes a breakage to a related test after
change bf57edf80f246d1ba8ae3a8b5779adc5ab554c62
Bug: 1508061
Change-Id: I4c3881b2498d33115a463147a236ee0fe8a09357
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5122083
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237720}
diff --git a/media/gpu/android/media_codec_video_decoder.cc b/media/gpu/android/media_codec_video_decoder.cc
index 9e8f6a8..a77616f 100644
--- a/media/gpu/android/media_codec_video_decoder.cc
+++ b/media/gpu/android/media_codec_video_decoder.cc
@@ -82,6 +82,10 @@
!can_use_builtin_software_decoder ||
allow_media_codec_software_decoder;
if (info.is_software_codec && !is_os_software_decoder_allowed) {
+ supported_configs.emplace_back(info.profile, info.profile,
+ info.coded_size_min, info.coded_size_max,
+ kAllowEncrypted,
+ /*require_encrypted=*/true);
continue;
}
diff --git a/media/gpu/android/media_codec_video_decoder_unittest.cc b/media/gpu/android/media_codec_video_decoder_unittest.cc
index e3b1bf4..988dafd 100644
--- a/media/gpu/android/media_codec_video_decoder_unittest.cc
+++ b/media/gpu/android/media_codec_video_decoder_unittest.cc
@@ -350,9 +350,21 @@
ASSERT_TRUE(Initialize(TestVideoConfig::NormalH264()));
}
+// Ensures that we always report support for low resolution encrypted content
+// since Android guarantees support for these codecs.
+TEST_P(MediaCodecVideoDecoderTest, SoftwareDecodersSupportEncrypted) {
+ auto configs = MediaCodecVideoDecoder::GetSupportedConfigs();
+ for (const auto& c : configs) {
+ if (c.Matches(TestVideoConfig::NormalEncrypted(GetParam()))) {
+ return;
+ }
+ }
+ FAIL() << "No encrypted config found for " << GetCodecName(GetParam());
+}
+
TEST_P(MediaCodecVideoDecoderVp8Test, SmallVp8IsRejected) {
auto configs = MediaCodecVideoDecoder::GetSupportedConfigs();
- auto small_vp8_config = TestVideoConfig::Normal();
+ auto small_vp8_config = TestVideoConfig::Normal(VideoCodec::kVP8);
for (const auto& c : configs)
ASSERT_FALSE(c.Matches(small_vp8_config));
}