Commit d532efac authored by liberato's avatar liberato Committed by Commit bot

Always allow MediaCodec for encrypted VPx content.

https://codereview.chromium.org/2334223009 caused AVDA to avoid VPx
content < 360p.  Unfortunately, it did not have an exception for
encrypted content.

This CL adds an addition "encrypted only" profile that covers all
supported sizes.

BUG=647259, 642948

Review-Url: https://codereview.chromium.org/2348653002
Cr-Commit-Position: refs/heads/master@{#419108}
parent eda0b8d4
...@@ -1568,6 +1568,8 @@ AndroidVideoDecodeAccelerator::GetCapabilities( ...@@ -1568,6 +1568,8 @@ AndroidVideoDecodeAccelerator::GetCapabilities(
profile.profile = VP8PROFILE_ANY; profile.profile = VP8PROFILE_ANY;
// Since there is little to no power benefit below 360p, don't advertise // 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. // 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.min_resolution.SetSize(480, 360);
profile.max_resolution.SetSize(3840, 2160); profile.max_resolution.SetSize(3840, 2160);
// If we know MediaCodec will just create a software codec, prefer our // If we know MediaCodec will just create a software codec, prefer our
...@@ -1578,9 +1580,20 @@ AndroidVideoDecodeAccelerator::GetCapabilities( ...@@ -1578,9 +1580,20 @@ AndroidVideoDecodeAccelerator::GetCapabilities(
profile.encrypted_only = profile.encrypted_only =
VideoCodecBridge::IsKnownUnaccelerated(kCodecVP8, MEDIA_CODEC_DECODER); VideoCodecBridge::IsKnownUnaccelerated(kCodecVP8, MEDIA_CODEC_DECODER);
profiles.push_back(profile); 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()) { if (MediaCodecUtil::IsVp9DecoderAvailable()) {
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);
for (int i = 0; profile_types[i] != VIDEO_CODEC_PROFILE_UNKNOWN; i++) {
SupportedProfile profile; SupportedProfile profile;
// Limit to 360p, like we do for vp8. See above. // Limit to 360p, like we do for vp8. See above.
profile.min_resolution.SetSize(480, 360); profile.min_resolution.SetSize(480, 360);
...@@ -1590,17 +1603,16 @@ AndroidVideoDecodeAccelerator::GetCapabilities( ...@@ -1590,17 +1603,16 @@ AndroidVideoDecodeAccelerator::GetCapabilities(
// within the renderer sandbox. However if the content is encrypted, we // within the renderer sandbox. However if the content is encrypted, we
// must use MediaCodec anyways since MediaDrm offers no way to decrypt // must use MediaCodec anyways since MediaDrm offers no way to decrypt
// the buffers and let us use our internal software decoders. // the buffers and let us use our internal software decoders.
profile.encrypted_only = profile.encrypted_only = is_known_unaccelerated;
VideoCodecBridge::IsKnownUnaccelerated(kCodecVP9, MEDIA_CODEC_DECODER); profile.profile = profile_types[i];
profile.profile = VP9PROFILE_PROFILE0;
profiles.push_back(profile); profiles.push_back(profile);
profile.profile = VP9PROFILE_PROFILE1;
profiles.push_back(profile); // Always allow encrypted content.
profile.profile = VP9PROFILE_PROFILE2; profile.min_resolution.SetSize(0, 0);
profiles.push_back(profile); profile.encrypted_only = true;
profile.profile = VP9PROFILE_PROFILE3;
profiles.push_back(profile); profiles.push_back(profile);
} }
}
for (const auto& supported_profile : kSupportedH264Profiles) { for (const auto& supported_profile : kSupportedH264Profiles) {
SupportedProfile profile; SupportedProfile profile;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment