Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: media/filters/gpu_video_decoder.cc

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nit Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e1e770b081aec0645f96aabea0559530fccfda88 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() &&
xhwang 2015/03/26 06:15:31 nit: s/if/return
henryhsu_tw 2015/03/26 09:38:34 Done.
+ 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,21 @@ void GpuVideoDecoder::NotifyError(media::VideoDecodeAccelerator::Error error) {
DestroyVDA();
}
+bool GpuVideoDecoder::IsProfileSupported(VideoCodecProfile profile,
+ const gfx::Size& coded_size) {
+ DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
+ std::vector<VideoDecodeAccelerator::SupportedProfile> supported_profiles;
+ supported_profiles = factories_->GetVideoDecodeAcceleratorSupportedProfiles();
xhwang 2015/03/26 06:15:32 nit: you can merge these two lines.
henryhsu_tw 2015/03/26 09:38:34 Done.
+ for (const auto& supported_profile : supported_profiles) {
+ if (profile == supported_profile.profile) {
+ return IsCodedSizeSupported(coded_size,
+ supported_profile.min_resolution,
+ supported_profile.max_resolution);
+ }
+ }
+ return false;
+}
+
void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
const {
DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698