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

Unified Diff: content/common/gpu/media/android_video_decode_accelerator.cc

Issue 795633005: Add VDA supported profile to GPUInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: edit description Created 6 years 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: content/common/gpu/media/android_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/android_video_decode_accelerator.cc b/content/common/gpu/media/android_video_decode_accelerator.cc
index 8fbdeb147c987510e6b48a7b7844cab15b78cd82..f9cb1ebd3b48da9958dcff82428d91bdf8b674c1 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -19,6 +19,12 @@
namespace content {
+// Limit default max video codec size for Android to avoid
+// HW codec initialization failure for resolution higher than 720p.
+// Default values are from Libjingle "jsepsessiondescription.cc".
+const int kMaxDecodeFrameWidth = 1280;
wuchengli 2014/12/19 03:35:17 Why this? Originally android VDA doesn't have this
+const int kMaxDecodeFrameHeight = 720;
+
// Helper macros for dealing with failure. If |result| evaluates false, emit
// |log| to ERROR, register |error| with the decoder, and return.
#define RETURN_ON_FAILURE(result, log, error) \
@@ -82,6 +88,35 @@ AndroidVideoDecodeAccelerator::~AndroidVideoDecodeAccelerator() {
DCHECK(thread_checker_.CalledOnValidThread());
}
+// static
+std::vector<media::VideoDecodeAccelerator::SupportedProfile>
+AndroidVideoDecodeAccelerator::GetSupportedProfiles() {
wuchengli 2014/12/19 11:21:57 As discussed, it becomes a huge change to support
+ std::vector<SupportedProfile> profiles;
+ const struct {
+ const media::VideoCodec codec;
+ const media::VideoCodecProfile profile;
+ } kSupportedCodecs[] = {
+ { media::kCodecVP8, media::VP8PROFILE_ANY },
wuchengli 2014/12/19 03:35:17 See line 127. Only VP8 is supported. Please combin
+ { media::kCodecH264, media::H264PROFILE_BASELINE },
+ { media::kCodecH264, media::H264PROFILE_MAIN }
+ };
+
+ SupportedProfile profile;
+ // It would be nice if MediaCodec exposes the maximum capabilities of
+ // the decoder. Hard-code some reasonable defaults as workaround.
+ profile.max_resolution.SetSize(kMaxDecodeFrameWidth, kMaxDecodeFrameHeight);
+ profile.min_resolution.SetSize(1, 1);
+ for (const auto& supported_codec : kSupportedCodecs) {
+ if (VideoCodecBridge::IsKnownUnaccelerated(supported_codec.codec,
+ media::MEDIA_CODEC_ENCODER)) {
wuchengli 2014/12/19 03:35:18 This should be decoder. You need to test this on a
+ continue;
+ }
+ profile.profile = supported_codec.profile;
+ profiles.push_back(profile);
+ }
+ return profiles;
+}
+
bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
Client* client) {
DCHECK(!media_codec_);

Powered by Google App Engine
This is Rietveld 408576698