| 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" |
| 28 #include "media/base/media_switches.h" | 29 #include "media/base/media_switches.h" |
| 29 #include "media/base/timestamp_constants.h" | 30 #include "media/base/timestamp_constants.h" |
| 30 #include "media/base/video_decoder_config.h" | 31 #include "media/base/video_decoder_config.h" |
| 31 #include "media/video/picture.h" | 32 #include "media/video/picture.h" |
| 32 #include "ui/gl/android/scoped_java_surface.h" | 33 #include "ui/gl/android/scoped_java_surface.h" |
| 33 #include "ui/gl/android/surface_texture.h" | 34 #include "ui/gl/android/surface_texture.h" |
| 34 #include "ui/gl/gl_bindings.h" | 35 #include "ui/gl/gl_bindings.h" |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 } | 985 } |
| 985 | 986 |
| 986 // static | 987 // static |
| 987 media::VideoDecodeAccelerator::Capabilities | 988 media::VideoDecodeAccelerator::Capabilities |
| 988 AndroidVideoDecodeAccelerator::GetCapabilities() { | 989 AndroidVideoDecodeAccelerator::GetCapabilities() { |
| 989 Capabilities capabilities; | 990 Capabilities capabilities; |
| 990 SupportedProfiles& profiles = capabilities.supported_profiles; | 991 SupportedProfiles& profiles = capabilities.supported_profiles; |
| 991 | 992 |
| 992 SupportedProfile profile; | 993 SupportedProfile profile; |
| 993 | 994 |
| 994 profile.profile = media::VP8PROFILE_ANY; | 995 if (!media::MediaCodecUtil::IsVp8Blacklisted()) { |
| 995 profile.min_resolution.SetSize(0, 0); | 996 profile.profile = media::VP8PROFILE_ANY; |
| 996 profile.max_resolution.SetSize(1920, 1088); | 997 profile.min_resolution.SetSize(0, 0); |
| 997 profiles.push_back(profile); | 998 profile.max_resolution.SetSize(1920, 1088); |
| 999 profiles.push_back(profile); |
| 1000 } |
| 998 | 1001 |
| 999 profile.profile = media::VP9PROFILE_ANY; | 1002 profile.profile = media::VP9PROFILE_ANY; |
| 1000 profile.min_resolution.SetSize(0, 0); | 1003 profile.min_resolution.SetSize(0, 0); |
| 1001 profile.max_resolution.SetSize(1920, 1088); | 1004 profile.max_resolution.SetSize(1920, 1088); |
| 1002 profiles.push_back(profile); | 1005 profiles.push_back(profile); |
| 1003 | 1006 |
| 1004 for (const auto& supported_profile : kSupportedH264Profiles) { | 1007 for (const auto& supported_profile : kSupportedH264Profiles) { |
| 1005 SupportedProfile profile; | 1008 SupportedProfile profile; |
| 1006 profile.profile = supported_profile; | 1009 profile.profile = supported_profile; |
| 1007 profile.min_resolution.SetSize(0, 0); | 1010 profile.min_resolution.SetSize(0, 0); |
| 1008 // Advertise support for 4k and let the MediaCodec fail when decoding if it | 1011 // Advertise support for 4k and let the MediaCodec fail when decoding if it |
| 1009 // doesn't support the resolution. It's assumed that consumers won't have | 1012 // doesn't support the resolution. It's assumed that consumers won't have |
| 1010 // software fallback for H264 on Android anyway. | 1013 // software fallback for H264 on Android anyway. |
| 1011 profile.max_resolution.SetSize(3840, 2160); | 1014 profile.max_resolution.SetSize(3840, 2160); |
| 1012 profiles.push_back(profile); | 1015 profiles.push_back(profile); |
| 1013 } | 1016 } |
| 1014 | 1017 |
| 1015 if (UseDeferredRenderingStrategy()) { | 1018 if (UseDeferredRenderingStrategy()) { |
| 1016 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: | 1019 capabilities.flags = media::VideoDecodeAccelerator::Capabilities:: |
| 1017 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | | 1020 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE | |
| 1018 media::VideoDecodeAccelerator::Capabilities:: | 1021 media::VideoDecodeAccelerator::Capabilities:: |
| 1019 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; | 1022 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; |
| 1020 } | 1023 } |
| 1021 | 1024 |
| 1022 return capabilities; | 1025 return capabilities; |
| 1023 } | 1026 } |
| 1024 | 1027 |
| 1025 } // namespace content | 1028 } // namespace content |
| OLD | NEW |