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..b1ec19ea1573c1fe81b38eaf13b1886e4a44fb19 100644 |
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc |
@@ -8,6 +8,7 @@ |
#include "base/bind.h" |
#include "base/command_line.h" |
+#include "base/cpu.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop_proxy.h" |
#include "base/stl_util.h" |
@@ -20,6 +21,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 +317,42 @@ void GpuVideoDecodeAccelerator::Initialize( |
SendCreateDecoderReply(init_done_msg, true); |
} |
+gpu::VideoDecodeAcceleratorSupportedResolution |
+GpuVideoDecodeAccelerator::GetSupportedResolution() { |
+ gpu::VideoDecodeAcceleratorSupportedResolution resolution; |
+ // Set default values. |
+ resolution.min.SetSize(16, 16); |
wuchengli
2014/12/23 03:37:20
Moving this line to non-windows case (line 334) is
henryhsu
2014/12/23 05:52:06
Done.
|
+ // Use 1088 to account for 16x16 macroblocks. |
+ resolution.max.SetSize(1920, 1088); |
+ |
+#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 |
+ resolution.min.SetSize(48, 48); |
+#else |
+ // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. |
+ // NOTE: additional autodetection logic may require updating input buffer size |
+ // selection in platform-specific implementations, such as |
+ // V4L2VideoDecodeAccelerator. |
+ base::CPU cpu; |
+ bool hw_large_video_support = |
+ CommandLine::ForCurrentProcess()->HasSwitch( |
wuchengli
2014/12/23 03:37:20
Please test this and make sure HasSwitch is workin
henryhsu
2014/12/23 05:52:06
Tested on peach_pi and this switch is 1.
|
+ switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode) || |
+ ((cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55); |
+ if (hw_large_video_support) { |
+#if defined(OS_CHROMEOS) |
+ resolution.max.SetSize(4096, 2160); |
+#else |
+ // For non-Windows and non-ChromeOs platform. |
wuchengli
2014/12/23 03:37:20
Please add comments to explain kMaxDimension is no
henryhsu
2014/12/23 05:52:06
Done.
|
+ resolution.max.SetSize( |
+ media::limits::kMaxDimension, media::limits::kMaxDimension); |
+#endif |
+ } |
+#endif |
+ return resolution; |
+} |
+ |
// Runs on IO thread if video_decode_accelerator_->CanDecodeOnIOThread() is |
// true, otherwise on the main thread. |
void GpuVideoDecodeAccelerator::OnDecode( |