OLD | NEW |
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 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 } | 1556 } |
1557 } | 1557 } |
1558 | 1558 |
1559 // static | 1559 // static |
1560 VideoDecodeAccelerator::Capabilities | 1560 VideoDecodeAccelerator::Capabilities |
1561 AndroidVideoDecodeAccelerator::GetCapabilities( | 1561 AndroidVideoDecodeAccelerator::GetCapabilities( |
1562 const gpu::GpuPreferences& gpu_preferences) { | 1562 const gpu::GpuPreferences& gpu_preferences) { |
1563 Capabilities capabilities; | 1563 Capabilities capabilities; |
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 if (MediaCodecUtil::IsVp8DecoderAvailable()) { |
1567 // tear down the MediaCodec on surface destruction because VP8 requires | |
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. | |
1570 if (base::android::BuildInfo::GetInstance()->sdk_int() >= 18 && | |
1571 MediaCodecUtil::IsVp8DecoderAvailable()) { | |
1572 SupportedProfile profile; | 1567 SupportedProfile profile; |
1573 profile.profile = VP8PROFILE_ANY; | 1568 profile.profile = VP8PROFILE_ANY; |
1574 profile.min_resolution.SetSize(0, 0); | 1569 profile.min_resolution.SetSize(0, 0); |
1575 profile.max_resolution.SetSize(3840, 2160); | 1570 profile.max_resolution.SetSize(3840, 2160); |
1576 // If we know MediaCodec will just create a software codec, prefer our | 1571 // 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 | 1572 // internal software decoder instead. It's more up to date and secured |
1578 // within the renderer sandbox. However if the content is encrypted, we | 1573 // within the renderer sandbox. However if the content is encrypted, we |
1579 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1574 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
1580 // the buffers and let us use our internal software decoders. | 1575 // the buffers and let us use our internal software decoders. |
1581 profile.encrypted_only = | 1576 profile.encrypted_only = |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 | 1641 |
1647 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() | 1642 bool AndroidVideoDecodeAccelerator::IsMediaCodecSoftwareDecodingForbidden() |
1648 const { | 1643 const { |
1649 // Prevent MediaCodec from using its internal software decoders when we have | 1644 // Prevent MediaCodec from using its internal software decoders when we have |
1650 // more secure and up to date versions in the renderer process. | 1645 // more secure and up to date versions in the renderer process. |
1651 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || | 1646 return !config_.is_encrypted && (codec_config_->codec_ == kCodecVP8 || |
1652 codec_config_->codec_ == kCodecVP9); | 1647 codec_config_->codec_ == kCodecVP9); |
1653 } | 1648 } |
1654 | 1649 |
1655 } // namespace media | 1650 } // namespace media |
OLD | NEW |