Chromium Code Reviews| Index: content/common/gpu/media/gpu_video_decode_accelerator.cc |
| diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| index f741cb20418fbecfa99b83d54dd814f131c33892..5f47c96b53b7db204dec768a371ec41b2267c194 100644 |
| --- a/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| +++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc |
| @@ -20,6 +20,7 @@ |
| #include "ipc/ipc_message_utils.h" |
| #include "ipc/message_filter.h" |
| #include "media/base/limits.h" |
| +#include "media/base/media_switches.h" |
| #include "ui/gl/gl_context.h" |
| #include "ui/gl/gl_surface_egl.h" |
| @@ -315,6 +316,50 @@ void GpuVideoDecodeAccelerator::Initialize( |
| SendCreateDecoderReply(init_done_msg, true); |
| } |
| +// static |
| +std::vector<gpu::VideoDecodeAcceleratorSupportedProfile> |
| +GpuVideoDecodeAccelerator::GetSupportedProfiles() { |
| + std::vector<media::VideoDecodeAccelerator::SupportedProfile> profiles; |
| + media::VideoDecodeAccelerator::SupportedProfile profile; |
| + profile.profile = media::VIDEO_CODEC_PROFILE_UNKNOWN; |
|
wuchengli
2014/12/19 03:35:18
We shouldn't return unknown. Find the right profil
|
| + |
| +#if defined(OS_WIN) |
| + // Windows Media Foundation H.264 decoding does not support decoding videos |
| + // with any dimension smaller than 48 pixels: |
| + // http://msdn.microsoft.com/en-us/library/windows/desktop/dd797815 |
| + profile.min_resolution.SetSize(48, 48); |
| + profile.max_resolution.SetSize(1920, 1088); |
| + profiles.push_back(profile); |
|
wuchengli
2014/12/19 03:35:18
We cannot return unknown.
|
| +#else |
| +#if defined(OS_CHROMEOS) && defined(USE_X11) |
| +#if defined(ARCH_CPU_ARMEL) |
| + profiles = V4L2VideoDecodeAccelerator::GetSupportedProfiles(); |
| +#elif defined(ARCH_CPU_X86_FAMILY) |
| + profiles = VaapiVideoDecodeAccelerator::GetSupportedProfiles(); |
| +#endif |
| +#elif defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| + profiles = AndroidVideoDecodeAccelerator::GetSupportedProfiles(); |
| +#endif |
| +#endif |
| + return ConvertMediaToGpuProfiles(profiles); |
| +} |
| + |
| +// static |
| +std::vector<gpu::VideoDecodeAcceleratorSupportedProfile> |
| +GpuVideoDecodeAccelerator::ConvertMediaToGpuProfiles(const std::vector< |
| + media::VideoDecodeAccelerator::SupportedProfile>& media_profiles) { |
| + std::vector<gpu::VideoDecodeAcceleratorSupportedProfile> profiles; |
| + for (size_t i = 0; i < media_profiles.size(); i++) { |
| + gpu::VideoDecodeAcceleratorSupportedProfile profile; |
| + profile.profile = |
| + static_cast<gpu::VideoCodecProfile>(media_profiles[i].profile); |
|
wuchengli
2014/12/19 03:35:18
This can also go to gpu_video_accelerator_unit.h/.
|
| + profile.max_resolution = media_profiles[i].max_resolution; |
| + profile.min_resolution = media_profiles[i].min_resolution; |
| + profiles.push_back(profile); |
| + } |
| + return profiles; |
| +} |
| + |
| // Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
| // true, otherwise on the main thread. |
| void GpuVideoDecodeAccelerator::OnDecode( |