Index: content/common/gpu/media/vaapi_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.cc b/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
index df1f6443421d197b67aa31ef61634307175a242d..65c1b2754aa3b4b0980df91e55f27738f447ccd3 100644 |
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
@@ -3,6 +3,8 @@ |
// found in the LICENSE file. |
#include "base/bind.h" |
+#include "base/command_line.h" |
+#include "base/cpu.h" |
#include "base/debug/trace_event.h" |
#include "base/logging.h" |
#include "base/metrics/histogram.h" |
@@ -13,7 +15,9 @@ |
#include "content/common/gpu/gpu_channel.h" |
#include "content/common/gpu/media/vaapi_video_decode_accelerator.h" |
#include "media/base/bind_to_current_loop.h" |
+#include "media/base/media_switches.h" |
#include "media/video/picture.h" |
+#include "ui/gfx/x/x11_types.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/scoped_binders.h" |
@@ -226,6 +230,35 @@ VaapiVideoDecodeAccelerator::TFPPicture* |
return it->second.get(); |
} |
+// static |
+std::vector<media::VideoDecodeAccelerator::SupportedProfile> |
+VaapiVideoDecodeAccelerator::GetSupportedProfiles() { |
+ std::vector<SupportedProfile> profiles; |
+ std::vector<media::VideoCodecProfile> hw_profiles = |
+ VaapiWrapper::GetSupportedProfiles( |
+ gfx::GetXDisplay(), base::Bind(&base::DoNothing)); |
+ |
+ SupportedProfile profile; |
+ profile.min_resolution.SetSize(1, 1); |
+ |
+ // Ivy Bridge+ platforms can support more than 1920x1080. |
+ base::CPU cpu; |
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
+ bool hw_large_video_support = cmd_line->HasSwitch( |
+ switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode) || |
+ ((cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55); |
+ if (hw_large_video_support) |
+ profile.max_resolution.SetSize(4096, 2160); |
+ else |
+ profile.max_resolution.SetSize(1920, 1088); |
+ |
+ for (size_t i = 0; i < hw_profiles.size(); i++) { |
+ profile.profile = hw_profiles[i]; |
+ profiles.push_back(profile); |
+ } |
+ return profiles; |
+} |
+ |
VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
Display* x_display, |
const base::Callback<bool(void)>& make_context_current) |