| 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 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 return !gpu_preferences.enable_threaded_texture_mailboxes; | 1396 return !gpu_preferences.enable_threaded_texture_mailboxes; |
| 1397 } | 1397 } |
| 1398 | 1398 |
| 1399 // static | 1399 // static |
| 1400 media::VideoDecodeAccelerator::Capabilities | 1400 media::VideoDecodeAccelerator::Capabilities |
| 1401 AndroidVideoDecodeAccelerator::GetCapabilities( | 1401 AndroidVideoDecodeAccelerator::GetCapabilities( |
| 1402 const gpu::GpuPreferences& gpu_preferences) { | 1402 const gpu::GpuPreferences& gpu_preferences) { |
| 1403 Capabilities capabilities; | 1403 Capabilities capabilities; |
| 1404 SupportedProfiles& profiles = capabilities.supported_profiles; | 1404 SupportedProfiles& profiles = capabilities.supported_profiles; |
| 1405 | 1405 |
| 1406 SupportedProfile profile; | |
| 1407 | |
| 1408 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { | 1406 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { |
| 1407 SupportedProfile profile; |
| 1409 profile.profile = media::VP8PROFILE_ANY; | 1408 profile.profile = media::VP8PROFILE_ANY; |
| 1410 profile.min_resolution.SetSize(0, 0); | 1409 profile.min_resolution.SetSize(0, 0); |
| 1411 profile.max_resolution.SetSize(1920, 1088); | 1410 profile.max_resolution.SetSize(1920, 1088); |
| 1412 // If we know MediaCodec will just create a software codec, prefer our | 1411 // If we know MediaCodec will just create a software codec, prefer our |
| 1413 // internal software decoder instead. It's more up to date and secured | 1412 // internal software decoder instead. It's more up to date and secured |
| 1414 // within the renderer sandbox. However if the content is encrypted, we | 1413 // within the renderer sandbox. However if the content is encrypted, we |
| 1415 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1414 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1416 // the buffers and let us use our internal software decoders. | 1415 // the buffers and let us use our internal software decoders. |
| 1417 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1416 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1418 media::kCodecVP8, media::MEDIA_CODEC_DECODER); | 1417 media::kCodecVP8, media::MEDIA_CODEC_DECODER); |
| 1419 profiles.push_back(profile); | 1418 profiles.push_back(profile); |
| 1420 } | 1419 } |
| 1421 | 1420 |
| 1422 if (media::MediaCodecUtil::IsVp9DecoderAvailable()) { | 1421 if (media::MediaCodecUtil::IsVp9DecoderAvailable()) { |
| 1422 SupportedProfile profile; |
| 1423 profile.min_resolution.SetSize(0, 0); | 1423 profile.min_resolution.SetSize(0, 0); |
| 1424 profile.max_resolution.SetSize(1920, 1088); | 1424 profile.max_resolution.SetSize(1920, 1088); |
| 1425 // If we know MediaCodec will just create a software codec, prefer our | 1425 // If we know MediaCodec will just create a software codec, prefer our |
| 1426 // internal software decoder instead. It's more up to date and secured | 1426 // internal software decoder instead. It's more up to date and secured |
| 1427 // within the renderer sandbox. However if the content is encrypted, we | 1427 // within the renderer sandbox. However if the content is encrypted, we |
| 1428 // must use MediaCodec anyways since MediaDrm offers no way to decrypt | 1428 // must use MediaCodec anyways since MediaDrm offers no way to decrypt |
| 1429 // the buffers and let us use our internal software decoders. | 1429 // the buffers and let us use our internal software decoders. |
| 1430 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( | 1430 profile.encrypted_only = media::VideoCodecBridge::IsKnownUnaccelerated( |
| 1431 media::kCodecVP9, media::MEDIA_CODEC_DECODER); | 1431 media::kCodecVP9, media::MEDIA_CODEC_DECODER); |
| 1432 profile.profile = media::VP9PROFILE_PROFILE0; | 1432 profile.profile = media::VP9PROFILE_PROFILE0; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1443 SupportedProfile profile; | 1443 SupportedProfile profile; |
| 1444 profile.profile = supported_profile; | 1444 profile.profile = supported_profile; |
| 1445 profile.min_resolution.SetSize(0, 0); | 1445 profile.min_resolution.SetSize(0, 0); |
| 1446 // Advertise support for 4k and let the MediaCodec fail when decoding if it | 1446 // Advertise support for 4k and let the MediaCodec fail when decoding if it |
| 1447 // doesn't support the resolution. It's assumed that consumers won't have | 1447 // doesn't support the resolution. It's assumed that consumers won't have |
| 1448 // software fallback for H264 on Android anyway. | 1448 // software fallback for H264 on Android anyway. |
| 1449 profile.max_resolution.SetSize(3840, 2160); | 1449 profile.max_resolution.SetSize(3840, 2160); |
| 1450 profiles.push_back(profile); | 1450 profiles.push_back(profile); |
| 1451 } | 1451 } |
| 1452 | 1452 |
| 1453 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1454 SUPPORTS_DEFERRED_INITIALIZATION; |
| 1453 if (UseDeferredRenderingStrategy(gpu_preferences)) { | 1455 if (UseDeferredRenderingStrategy(gpu_preferences)) { |
| 1454 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1456 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
| 1455 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1457 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; |
| 1456 media::VideoDecodeAccelerator::Capabilities:: | |
| 1457 SUPPORTS_DEFERRED_INITIALIZATION; | |
| 1458 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { | 1458 if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) { |
| 1459 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: | 1459 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities:: |
| 1460 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1460 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1461 } | 1461 } |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 return capabilities; | 1464 return capabilities; |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 } // namespace media | 1467 } // namespace media |
| OLD | NEW |