| 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 "content/common/gpu/media/android_video_decode_accelerator.h" | 5 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 // internal software decoder instead. It's more up to date and secured | 1176 // internal software decoder instead. It's more up to date and secured |
| 1177 // within the renderer sandbox. However if the content is encrypted, we | 1177 // within the renderer sandbox. However if the content is encrypted, we |
| 1178 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1178 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1179 // the buffers and let us use our internal software decoders. | 1179 // the buffers and let us use our internal software decoders. |
| 1180 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1180 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1181 media::kCodecVP8, media::MEDIA_CODEC_DECODER); | 1181 media::kCodecVP8, media::MEDIA_CODEC_DECODER); |
| 1182 profiles.push_back(profile); | 1182 profiles.push_back(profile); |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 if (media::PlatformHasVp9Support()) { | 1185 if (media::PlatformHasVp9Support()) { |
| 1186 profile.profile = media::VP9PROFILE_ANY; | |
| 1187 profile.min_resolution.SetSize(0, 0); | 1186 profile.min_resolution.SetSize(0, 0); |
| 1188 profile.max_resolution.SetSize(1920, 1088); | 1187 profile.max_resolution.SetSize(1920, 1088); |
| 1189 // If we know MediaCodec will just create a software codec, prefer our | 1188 // If we know MediaCodec will just create a software codec, prefer our |
| 1190 // internal software decoder instead. It's more up to date and secured | 1189 // internal software decoder instead. It's more up to date and secured |
| 1191 // within the renderer sandbox. However if the content is encrypted, we | 1190 // within the renderer sandbox. However if the content is encrypted, we |
| 1192 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1191 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1193 // the buffers and let us use our internal software decoders. | 1192 // the buffers and let us use our internal software decoders. |
| 1194 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1193 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1195 media::kCodecVP9, media::MEDIA_CODEC_DECODER); | 1194 media::kCodecVP9, media::MEDIA_CODEC_DECODER); |
| 1195 profile.profile = media::VP9PROFILE_PROFILE0; |
| 1196 profiles.push_back(profile); |
| 1197 profile.profile = media::VP9PROFILE_PROFILE1; |
| 1198 profiles.push_back(profile); |
| 1199 profile.profile = media::VP9PROFILE_PROFILE2; |
| 1200 profiles.push_back(profile); |
| 1201 profile.profile = media::VP9PROFILE_PROFILE3; |
| 1196 profiles.push_back(profile); | 1202 profiles.push_back(profile); |
| 1197 } | 1203 } |
| 1198 | 1204 |
| 1199 for (const auto& supported_profile : kSupportedH264Profiles) { | 1205 for (const auto& supported_profile : kSupportedH264Profiles) { |
| 1200 SupportedProfile profile; | 1206 SupportedProfile profile; |
| 1201 profile.profile = supported_profile; | 1207 profile.profile = supported_profile; |
| 1202 profile.min_resolution.SetSize(0, 0); | 1208 profile.min_resolution.SetSize(0, 0); |
| 1203 // Advertise support for 4k and let the MediaCodec fail when decoding if it | 1209 // Advertise support for 4k and let the MediaCodec fail when decoding if it |
| 1204 // doesn't support the resolution. It's assumed that consumers won't have | 1210 // doesn't support the resolution. It's assumed that consumers won't have |
| 1205 // software fallback for H264 on Android anyway. | 1211 // software fallback for H264 on Android anyway. |
| 1206 profile.max_resolution.SetSize(3840, 2160); | 1212 profile.max_resolution.SetSize(3840, 2160); |
| 1207 profiles.push_back(profile); | 1213 profiles.push_back(profile); |
| 1208 } | 1214 } |
| 1209 | 1215 |
| 1210 if (UseDeferredRenderingStrategy()) { | 1216 if (UseDeferredRenderingStrategy()) { |
| 1211 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1217 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1212 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1218 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1213 media::VideoDecodeAccelerator::Capabilities:: | 1219 media::VideoDecodeAccelerator::Capabilities:: |
| 1214 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1220 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1215 } | 1221 } |
| 1216 | 1222 |
| 1217 return capabilities; | 1223 return capabilities; |
| 1218 } | 1224 } |
| 1219 | 1225 |
| 1220 } // namespace content | 1226 } // namespace content |
| OLD | NEW |