Index: media/filters/gpu_video_decoder.cc |
diff --git a/media/filters/gpu_video_decoder.cc b/media/filters/gpu_video_decoder.cc |
index 703cb20dbb1284bc1650d5cde120c850ceeb356f..985909d5f61bf83ce382f77fdf4bede9ec9fe249 100644 |
--- a/media/filters/gpu_video_decoder.cc |
+++ b/media/filters/gpu_video_decoder.cc |
@@ -97,33 +97,16 @@ void GpuVideoDecoder::Reset(const base::Closure& closure) { |
vda_->Reset(); |
} |
-static bool IsCodedSizeSupported(const gfx::Size& coded_size) { |
-#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 |
- if (coded_size.width() < 48 || coded_size.height() < 48) |
- return false; |
-#endif |
- |
- // Only non-Windows, Ivy Bridge+ platforms can support more than 1920x1080. |
- // We test against 1088 to account for 16x16 macroblocks. |
- if (coded_size.width() <= 1920 && coded_size.height() <= 1088) |
+static bool IsCodedSizeSupported(const gfx::Size& coded_size, |
+ const gfx::Size& min_resolution, |
+ const gfx::Size& max_resolution) { |
+ if (coded_size.width() <= max_resolution.width() && |
+ coded_size.height() <= max_resolution.height() && |
+ coded_size.width() >= min_resolution.width() && |
+ coded_size.height() >= min_resolution.height()) { |
return true; |
- |
- // 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 = |
- base::CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kIgnoreResolutionLimitsForAcceleratedVideoDecode) || |
- ((cpu.vendor_name() == "GenuineIntel") && cpu.model() >= 55); |
- bool os_large_video_support = true; |
-#if defined(OS_WIN) |
- os_large_video_support = false; |
-#endif |
- return os_large_video_support && hw_large_video_support; |
+ } |
+ return false; |
} |
// Report |status| to UMA and run |cb| with it. This is super-specific to the |
@@ -166,7 +149,7 @@ void GpuVideoDecoder::Initialize(const VideoDecoderConfig& config, |
return; |
} |
- if (!IsCodedSizeSupported(config.coded_size())) { |
+ if (!IsProfileSupported(config.profile(), config.coded_size())) { |
status_cb.Run(DECODER_ERROR_NOT_SUPPORTED); |
return; |
} |
@@ -590,6 +573,38 @@ void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) { |
DestroyVDA(); |
} |
+bool GpuVideoDecoder::IsProfileSupported(const VideoCodecProfile& profile, |
+ const gfx::Size& coded_size) { |
+ DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
+ bool support_query_profile = false; |
+ std::vector<VideoDecodeAccelerator::SupportedProfile> supported_profiles = |
+ factories_->GetVideoDecodeAcceleratorSupportedProfiles( |
+ &support_query_profile); |
+ if (support_query_profile) { |
+ for (const auto& supported_profile : supported_profiles) { |
+ if (profile == supported_profile.profile && |
+ IsCodedSizeSupported(coded_size, |
+ supported_profile.min_resolution, |
+ supported_profile.max_resolution)) { |
wuchengli
2015/03/18 08:02:38
Can you check with Pawel if max_resolution indicat
|
+ return true; |
+ } |
+ } |
+ } else { |
+#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 |
+ // Use 1088 to account for 16x16 macroblocks. |
+ return IsCodedSizeSupported( |
+ coded_size, gfx::Size(48, 48), gfx::Size(1920, 1088)); |
+#else |
+ return IsCodedSizeSupported( |
+ coded_size, gfx::Size(16, 16), gfx::Size(1920, 1088)); |
+#endif |
+ } |
+ return false; |
+} |
+ |
void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
const { |
DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |