| 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 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 return !gpu_preferences.enable_threaded_texture_mailboxes; | 1285 return !gpu_preferences.enable_threaded_texture_mailboxes; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 // static | 1288 // static |
| 1289 media::VideoDecodeAccelerator::Capabilities | 1289 media::VideoDecodeAccelerator::Capabilities |
| 1290 AndroidVideoDecodeAccelerator::GetCapabilities( | 1290 AndroidVideoDecodeAccelerator::GetCapabilities( |
| 1291 const gpu::GpuPreferences& gpu_preferences) { | 1291 const gpu::GpuPreferences& gpu_preferences) { |
| 1292 Capabilities capabilities; | 1292 Capabilities capabilities; |
| 1293 SupportedProfiles& profiles = capabilities.supported_profiles; | 1293 SupportedProfiles& profiles = capabilities.supported_profiles; |
| 1294 | 1294 |
| 1295 SupportedProfile profile; | |
| 1296 | |
| 1297 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { | 1295 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { |
| 1296 SupportedProfile profile; |
| 1298 profile.profile = media::VP8PROFILE_ANY; | 1297 profile.profile = media::VP8PROFILE_ANY; |
| 1299 profile.min_resolution.SetSize(0, 0); | 1298 profile.min_resolution.SetSize(0, 0); |
| 1300 profile.max_resolution.SetSize(1920, 1088); | 1299 profile.max_resolution.SetSize(1920, 1088); |
| 1301 // If we know MediaCodec will just create a software codec, prefer our | 1300 // If we know MediaCodec will just create a software codec, prefer our |
| 1302 // internal software decoder instead. It's more up to date and secured | 1301 // internal software decoder instead. It's more up to date and secured |
| 1303 // within the renderer sandbox. However if the content is encrypted, we | 1302 // within the renderer sandbox. However if the content is encrypted, we |
| 1304 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1303 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1305 // the buffers and let us use our internal software decoders. | 1304 // the buffers and let us use our internal software decoders. |
| 1306 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1305 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1307 media::kCodecVP8, media::MEDIA_CODEC_DECODER); | 1306 media::kCodecVP8, media::MEDIA_CODEC_DECODER); |
| 1308 profiles.push_back(profile); | 1307 profiles.push_back(profile); |
| 1309 } | 1308 } |
| 1310 | 1309 |
| 1311 if (media::MediaCodecUtil::IsVp9DecoderAvailable()) { | 1310 if (media::MediaCodecUtil::IsVp9DecoderAvailable()) { |
| 1311 SupportedProfile profile; |
| 1312 profile.min_resolution.SetSize(0, 0); | 1312 profile.min_resolution.SetSize(0, 0); |
| 1313 profile.max_resolution.SetSize(1920, 1088); | 1313 profile.max_resolution.SetSize(1920, 1088); |
| 1314 // If we know MediaCodec will just create a software codec, prefer our | 1314 // If we know MediaCodec will just create a software codec, prefer our |
| 1315 // internal software decoder instead. It's more up to date and secured | 1315 // internal software decoder instead. It's more up to date and secured |
| 1316 // within the renderer sandbox. However if the content is encrypted, we | 1316 // within the renderer sandbox. However if the content is encrypted, we |
| 1317 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1317 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1318 // the buffers and let us use our internal software decoders. | 1318 // the buffers and let us use our internal software decoders. |
| 1319 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1319 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1320 media::kCodecVP9, media::MEDIA_CODEC_DECODER); | 1320 media::kCodecVP9, media::MEDIA_CODEC_DECODER); |
| 1321 profile.profile = media::VP9PROFILE_PROFILE0; | 1321 profile.profile = media::VP9PROFILE_PROFILE0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1332 SupportedProfile profile; | 1332 SupportedProfile profile; |
| 1333 profile.profile = supported_profile; | 1333 profile.profile = supported_profile; |
| 1334 profile.min_resolution.SetSize(0, 0); | 1334 profile.min_resolution.SetSize(0, 0); |
| 1335 // Advertise support for 4k and let the MediaCodec fail when decoding if it | 1335 // Advertise support for 4k and let the MediaCodec fail when decoding if it |
| 1336 // doesn't support the resolution. It's assumed that consumers won't have | 1336 // doesn't support the resolution. It's assumed that consumers won't have |
| 1337 // software fallback for H264 on Android anyway. | 1337 // software fallback for H264 on Android anyway. |
| 1338 profile.max_resolution.SetSize(3840, 2160); | 1338 profile.max_resolution.SetSize(3840, 2160); |
| 1339 profiles.push_back(profile); | 1339 profiles.push_back(profile); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1343 SUPPORTS_DEFERRED_INITIALIZATION; |
| 1342 if (UseDeferredRenderingStrategy(gpu_preferences)) { | 1344 if (UseDeferredRenderingStrategy(gpu_preferences)) { |
| 1343 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1345 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
| 1344 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1346 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; |
| 1345 media::VideoDecodeAccelerator::Capabilities:: | |
| 1346 SUPPORTS_DEFERRED_INITIALIZATION; | |
| 1347 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { | 1347 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { |
| 1348 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: | 1348 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
| 1349 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1349 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1350 } | 1350 } |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 return capabilities; | 1353 return capabilities; |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 } // namespace content | 1356 } // namespace content |
| OLD | NEW |