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

Side by Side Diff: media/gpu/android_video_decode_accelerator.cc

Issue 2334223009: Don't use AVDA for <360p VPx content. (Closed)
Patch Set: comments! 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/gpu/android_video_decode_accelerator.h" 5 #include "media/gpu/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 SupportedProfiles& profiles = capabilities.supported_profiles; 1564 SupportedProfiles& profiles = capabilities.supported_profiles;
1565 1565
1566 // Only support VP8 on Android versions where we don't have to synchronously 1566 // Only support VP8 on Android versions where we don't have to synchronously
1567 // tear down the MediaCodec on surface destruction because VP8 requires 1567 // tear down the MediaCodec on surface destruction because VP8 requires
1568 // us to completely drain the decoder before releasing it, which is difficult 1568 // us to completely drain the decoder before releasing it, which is difficult
1569 // and time consuming to do while the surface is being destroyed. 1569 // and time consuming to do while the surface is being destroyed.
1570 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18 && 1570 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18 &&
1571 MediaCodecUtil::IsVp8DecoderAvailable()) { 1571 MediaCodecUtil::IsVp8DecoderAvailable()) {
1572 SupportedProfile profile; 1572 SupportedProfile profile;
1573 profile.profile = VP8PROFILE_ANY; 1573 profile.profile = VP8PROFILE_ANY;
1574 profile.min_resolution.SetSize(0, 0); 1574 // Since there is little to no power benefit below 360p, don't advertise
1575 // support for it. Let libvpx decode it, and save a MediaCodec instance.
1576 profile.min_resolution.SetSize(480, 360);
1575 profile.max_resolution.SetSize(3840, 2160); 1577 profile.max_resolution.SetSize(3840, 2160);
1576 // If we know MediaCodec will just create a software codec, prefer our 1578 // If we know MediaCodec will just create a software codec, prefer our
1577 // internal software decoder instead. It's more up to date and secured 1579 // internal software decoder instead. It's more up to date and secured
1578 // within the renderer sandbox. However if the content is encrypted, we 1580 // within the renderer sandbox. However if the content is encrypted, we
1579 // must use MediaCodec anyways since MediaDrm offers no way to decrypt 1581 // must use MediaCodec anyways since MediaDrm offers no way to decrypt
1580 // the buffers and let us use our internal software decoders. 1582 // the buffers and let us use our internal software decoders.
1581 profile.encrypted_only = 1583 profile.encrypted_only =
1582 VideoCodecBridge::IsKnownUnaccelerated(kCodecVP8, MEDIA_CODEC_DECODER); 1584 VideoCodecBridge::IsKnownUnaccelerated(kCodecVP8, MEDIA_CODEC_DECODER);
1583 profiles.push_back(profile); 1585 profiles.push_back(profile);
1584 } 1586 }
1585 1587
1586 if (MediaCodecUtil::IsVp9DecoderAvailable()) { 1588 if (MediaCodecUtil::IsVp9DecoderAvailable()) {
1587 SupportedProfile profile; 1589 SupportedProfile profile;
1588 profile.min_resolution.SetSize(0, 0); 1590 // Limit to 360p, like we do for vp8. See above.
1591 profile.min_resolution.SetSize(480, 360);
1589 profile.max_resolution.SetSize(3840, 2160); 1592 profile.max_resolution.SetSize(3840, 2160);
1590 // If we know MediaCodec will just create a software codec, prefer our 1593 // If we know MediaCodec will just create a software codec, prefer our
1591 // internal software decoder instead. It's more up to date and secured 1594 // internal software decoder instead. It's more up to date and secured
1592 // within the renderer sandbox. However if the content is encrypted, we 1595 // within the renderer sandbox. However if the content is encrypted, we
1593 // must use MediaCodec anyways since MediaDrm offers no way to decrypt 1596 // must use MediaCodec anyways since MediaDrm offers no way to decrypt
1594 // the buffers and let us use our internal software decoders. 1597 // the buffers and let us use our internal software decoders.
1595 profile.encrypted_only = 1598 profile.encrypted_only =
1596 VideoCodecBridge::IsKnownUnaccelerated(kCodecVP9, MEDIA_CODEC_DECODER); 1599 VideoCodecBridge::IsKnownUnaccelerated(kCodecVP9, MEDIA_CODEC_DECODER);
1597 profile.profile = VP9PROFILE_PROFILE0; 1600 profile.profile = VP9PROFILE_PROFILE0;
1598 profiles.push_back(profile); 1601 profiles.push_back(profile);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1646 1649
1647 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() 1650 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden()
1648 const { 1651 const {
1649 // Prevent MediaCodec from using its internal software decoders when we have 1652 // Prevent MediaCodec from using its internal software decoders when we have
1650 // more secure and up to date versions in the renderer process. 1653 // more secure and up to date versions in the renderer process.
1651 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || 1654 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 ||
1652 codec_config_->codec_ == kCodecVP9); 1655 codec_config_->codec_ == kCodecVP9);
1653 } 1656 }
1654 1657
1655 } // namespace media 1658 } // namespace media
OLDNEW
« 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