| 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" |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
| 18 #include "content/common/gpu/gpu_channel.h" | 18 #include "content/common/gpu/gpu_channel.h" |
| 19 #include "content/common/gpu/media/android_copying_backing_strategy.h" | 19 #include "content/common/gpu/media/android_copying_backing_strategy.h" |
| 20 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" | 20 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 22 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 23 #include "gpu/command_buffer/service/gpu_switches.h" | 23 #include "gpu/command_buffer/service/gpu_switches.h" |
| 24 #include "gpu/command_buffer/service/mailbox_manager.h" | 24 #include "gpu/command_buffer/service/mailbox_manager.h" |
| 25 #include "media/base/android/media_codec_util.h" |
| 25 #include "media/base/bind_to_current_loop.h" | 26 #include "media/base/bind_to_current_loop.h" |
| 26 #include "media/base/bitstream_buffer.h" | 27 #include "media/base/bitstream_buffer.h" |
| 27 #include "media/base/limits.h" | 28 #include "media/base/limits.h" |
| 29 #include "media/base/media.h" |
| 28 #include "media/base/media_switches.h" | 30 #include "media/base/media_switches.h" |
| 29 #include "media/base/timestamp_constants.h" | 31 #include "media/base/timestamp_constants.h" |
| 30 #include "media/base/video_decoder_config.h" | 32 #include "media/base/video_decoder_config.h" |
| 31 #include "media/video/picture.h" | 33 #include "media/video/picture.h" |
| 32 #include "ui/gl/android/scoped_java_surface.h" | 34 #include "ui/gl/android/scoped_java_surface.h" |
| 33 #include "ui/gl/android/surface_texture.h" | 35 #include "ui/gl/android/surface_texture.h" |
| 34 #include "ui/gl/gl_bindings.h" | 36 #include "ui/gl/gl_bindings.h" |
| 35 | 37 |
| 36 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) | 38 #if defined(ENABLE_MOJO_MEDIA_IN_GPU_PROCESS) |
| 37 #include "media/base/media_keys.h" | 39 #include "media/base/media_keys.h" |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 } | 1000 } |
| 999 | 1001 |
| 1000 // static | 1002 // static |
| 1001 media::VideoDecodeAccelerator::Capabilities | 1003 media::VideoDecodeAccelerator::Capabilities |
| 1002 AndroidVideoDecodeAccelerator::GetCapabilities() { | 1004 AndroidVideoDecodeAccelerator::GetCapabilities() { |
| 1003 Capabilities capabilities; | 1005 Capabilities capabilities; |
| 1004 SupportedProfiles& profiles = capabilities.supported_profiles; | 1006 SupportedProfiles& profiles = capabilities.supported_profiles; |
| 1005 | 1007 |
| 1006 SupportedProfile profile; | 1008 SupportedProfile profile; |
| 1007 | 1009 |
| 1008 profile.profile = media::VP8PROFILE_ANY; | 1010 if (media::MediaCodecUtil::IsVp8DecoderAvailable()) { |
| 1009 profile.min_resolution.SetSize(0, 0); | 1011 profile.profile = media::VP8PROFILE_ANY; |
| 1010 profile.max_resolution.SetSize(1920, 1088); | 1012 profile.min_resolution.SetSize(0, 0); |
| 1011 profiles.push_back(profile); | 1013 profile.max_resolution.SetSize(1920, 1088); |
| 1014 profiles.push_back(profile); |
| 1015 } |
| 1012 | 1016 |
| 1013 profile.profile = media::VP9PROFILE_ANY; | 1017 if (media::PlatformHasVp9Support()) { |
| 1014 profile.min_resolution.SetSize(0, 0); | 1018 profile.profile = media::VP9PROFILE_ANY; |
| 1015 profile.max_resolution.SetSize(1920, 1088); | 1019 profile.min_resolution.SetSize(0, 0); |
| 1016 profiles.push_back(profile); | 1020 profile.max_resolution.SetSize(1920, 1088); |
| 1021 profiles.push_back(profile); |
| 1022 } |
| 1017 | 1023 |
| 1018 for (const auto& supported_profile : kSupportedH264Profiles) { | 1024 for (const auto& supported_profile : kSupportedH264Profiles) { |
| 1019 SupportedProfile profile; | 1025 SupportedProfile profile; |
| 1020 profile.profile = supported_profile; | 1026 profile.profile = supported_profile; |
| 1021 profile.min_resolution.SetSize(0, 0); | 1027 profile.min_resolution.SetSize(0, 0); |
| 1022 // Advertise support for 4k and let the MediaCodec fail when decoding if it | 1028 // Advertise support for 4k and let the MediaCodec fail when decoding if it |
| 1023 // doesn't support the resolution. It's assumed that consumers won't have | 1029 // doesn't support the resolution. It's assumed that consumers won't have |
| 1024 // software fallback for H264 on Android anyway. | 1030 // software fallback for H264 on Android anyway. |
| 1025 profile.max_resolution.SetSize(3840, 2160); | 1031 profile.max_resolution.SetSize(3840, 2160); |
| 1026 profiles.push_back(profile); | 1032 profiles.push_back(profile); |
| 1027 } | 1033 } |
| 1028 | 1034 |
| 1029 if (UseDeferredRenderingStrategy()) { | 1035 if (UseDeferredRenderingStrategy()) { |
| 1030 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1036 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1031 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1037 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1032 media::VideoDecodeAccelerator::Capabilities:: | 1038 media::VideoDecodeAccelerator::Capabilities:: |
| 1033 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1039 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1034 } | 1040 } |
| 1035 | 1041 |
| 1036 return capabilities; | 1042 return capabilities; |
| 1037 } | 1043 } |
| 1038 | 1044 |
| 1039 } // namespace content | 1045 } // namespace content |
| OLD | NEW |