Chromium Code Reviews| 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..bca25dfea8b255e090e297f097173fc4b61b95cc 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); |
|
wuchengli
2015/03/19 06:19:25
One concern. Does Mac accidentally use this and re
|
| - 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(); |
| + std::vector<VideoDecodeAccelerator::SupportedProfile> supported_profiles; |
| + bool support_query_profile = |
|
wuchengli
2015/03/19 06:19:25
s/profile/profiles/
henryhsu
2015/03/19 10:00:33
Done.
|
| + factories_->GetVideoDecodeAcceleratorSupportedProfiles( |
| + &supported_profiles); |
| + if (support_query_profile) { |
| + for (const auto& supported_profile : supported_profiles) { |
| + if (profile == supported_profile.profile && |
| + IsCodedSizeSupported(coded_size, |
|
wuchengli
2015/03/19 06:19:25
Profile won't duplicate. So move IsCodedSizeSuppor
henryhsu
2015/03/19 10:00:33
Done.
|
| + supported_profile.min_resolution, |
| + supported_profile.max_resolution)) { |
| + 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()); |