Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: media/gpu/android_video_decode_accelerator.cc

Issue 2348653002: Always allow MediaCodec for encrypted VPx content. (Closed)
Patch Set: cache IsKnownUnaccelerated Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/gpu/android_video_decode_accelerator.cc
diff --git a/media/gpu/android_video_decode_accelerator.cc b/media/gpu/android_video_decode_accelerator.cc
index 233d70910822699a47056296371f22119b286be3..7d54abc6c5e109598b07777202fa79d5439a420c 100644
--- a/media/gpu/android_video_decode_accelerator.cc
+++ b/media/gpu/android_video_decode_accelerator.cc
@@ -1573,6 +1573,8 @@ AndroidVideoDecodeAccelerator::GetCapabilities(
profile.profile = VP8PROFILE_ANY;
// Since there is little to no power benefit below 360p, don't advertise
// support for it. Let libvpx decode it, and save a MediaCodec instance.
+ // Note that we allow it anyway for encrypted content, since we push a
+ // separate profile for that.
profile.min_resolution.SetSize(480, 360);
profile.max_resolution.SetSize(3840, 2160);
// If we know MediaCodec will just create a software codec, prefer our
@@ -1583,28 +1585,38 @@ AndroidVideoDecodeAccelerator::GetCapabilities(
profile.encrypted_only =
VideoCodecBridge::IsKnownUnaccelerated(kCodecVP8, MEDIA_CODEC_DECODER);
profiles.push_back(profile);
+
+ // Always allow encrypted content, even at low resolutions.
+ profile.min_resolution.SetSize(0, 0);
+ profile.encrypted_only = true;
+ profiles.push_back(profile);
}
if (MediaCodecUtil::IsVp9DecoderAvailable()) {
- SupportedProfile profile;
- // Limit to 360p, like we do for vp8. See above.
- profile.min_resolution.SetSize(480, 360);
- profile.max_resolution.SetSize(3840, 2160);
- // If we know MediaCodec will just create a software codec, prefer our
- // internal software decoder instead. It's more up to date and secured
- // within the renderer sandbox. However if the content is encrypted, we
- // must use MediaCodec anyways since MediaDrm offers no way to decrypt
- // the buffers and let us use our internal software decoders.
- profile.encrypted_only =
+ const VideoCodecProfile profile_types[] = {
+ VP9PROFILE_PROFILE0, VP9PROFILE_PROFILE1, VP9PROFILE_PROFILE2,
+ VP9PROFILE_PROFILE3, VIDEO_CODEC_PROFILE_UNKNOWN};
+ const bool is_known_unaccelerated =
VideoCodecBridge::IsKnownUnaccelerated(kCodecVP9, MEDIA_CODEC_DECODER);
- profile.profile = VP9PROFILE_PROFILE0;
- profiles.push_back(profile);
- profile.profile = VP9PROFILE_PROFILE1;
- profiles.push_back(profile);
- profile.profile = VP9PROFILE_PROFILE2;
- profiles.push_back(profile);
- profile.profile = VP9PROFILE_PROFILE3;
- profiles.push_back(profile);
+ for (int i = 0; profile_types[i] != VIDEO_CODEC_PROFILE_UNKNOWN; i++) {
+ SupportedProfile profile;
+ // Limit to 360p, like we do for vp8. See above.
+ profile.min_resolution.SetSize(480, 360);
+ profile.max_resolution.SetSize(3840, 2160);
+ // If we know MediaCodec will just create a software codec, prefer our
+ // internal software decoder instead. It's more up to date and secured
+ // within the renderer sandbox. However if the content is encrypted, we
+ // must use MediaCodec anyways since MediaDrm offers no way to decrypt
+ // the buffers and let us use our internal software decoders.
+ profile.encrypted_only = is_known_unaccelerated;
+ profile.profile = profile_types[i];
+ profiles.push_back(profile);
+
+ // Always allow encrypted content.
+ profile.min_resolution.SetSize(0, 0);
+ profile.encrypted_only = true;
+ profiles.push_back(profile);
+ }
}
for (const auto& supported_profile : kSupportedH264Profiles) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698