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

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

Issue 1282083003: Add support for H264 and VP9 to AndroidVDA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: 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 06d59863d049cacd6c03b22a0ebbf0e908d9755e..68ebd7c16bdc3cb9834dd9e6b31677d258f32182 100644
--- a/content/common/gpu/media/android_video_decode_accelerator.cc
+++ b/content/common/gpu/media/android_video_decode_accelerator.cc
@@ -12,6 +12,7 @@
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "media/base/bitstream_buffer.h"
#include "media/base/limits.h"
+#include "media/base/video_decoder_config.h"
#include "media/video/picture.h"
#include "ui/gl/android/scoped_java_surface.h"
#include "ui/gl/android/surface_texture.h"
@@ -88,18 +89,19 @@ bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
DCHECK(thread_checker_.CalledOnValidThread());
client_ = client;
-
- if (profile == media::VP8PROFILE_ANY) {
- codec_ = media::kCodecVP8;
- } else {
- // TODO(dwkang): enable H264 once b/8125974 is fixed.
- LOG(ERROR) << "Unsupported profile: " << profile;
- return false;
+ codec_ = VideoCodecProfileToVideoCodec(profile);
+ if (codec_ != media::kCodecVP8 && codec_ != media::kCodecVP9 &&
+ codec_ != media::kCodecH264) {
+ DVLOG(1) << "Unsupported profile: " << profile;
sandersd (OOO until July 31) 2015/08/08 00:17:44 return false;
}
- // Only consider using MediaCodec if it's likely backed by hardware.
- if (media::VideoCodecBridge::IsKnownUnaccelerated(
+ // Only use MediaCodec for VP8/9 if it's likely backed by hardware.
+ if ((codec_ == media::kCodecVP8 || codec_ == media::kCodecVP9) &&
+ media::VideoCodecBridge::IsKnownUnaccelerated(
codec_, media::MEDIA_CODEC_DECODER)) {
+ DVLOG(1) << "Initialization failed because the "
+ << (codec_ == media::kCodecVP8 ? "vp8" : "vp9")
+ << " decoder is not hardware accelerated";
return false;
}
@@ -558,15 +560,32 @@ void AndroidVideoDecodeAccelerator::NotifyError(
media::VideoDecodeAccelerator::SupportedProfiles
AndroidVideoDecodeAccelerator::GetSupportedProfiles() {
SupportedProfiles profiles;
- if (media::VideoCodecBridge::IsKnownUnaccelerated(
+
+ if (!media::VideoCodecBridge::IsKnownUnaccelerated(
media::kCodecVP8, media::MEDIA_CODEC_DECODER)) {
- return profiles;
+ SupportedProfile profile;
+ profile.profile = media::VP8PROFILE_ANY;
+ profile.min_resolution.SetSize(0, 0);
+ profile.max_resolution.SetSize(3840, 2160);
+ profiles.push_back(profile);
}
+
+ if (!media::VideoCodecBridge::IsKnownUnaccelerated(
+ media::kCodecVP9, media::MEDIA_CODEC_DECODER)) {
+ SupportedProfile profile;
+ profile.profile = media::VP9PROFILE_ANY;
+ profile.min_resolution.SetSize(0, 0);
+ profile.max_resolution.SetSize(3840, 2160);
+ profiles.push_back(profile);
+ }
+
SupportedProfile profile;
- profile.profile = media::VP8PROFILE_ANY;
- profile.min_resolution.SetSize(16, 16);
- profile.max_resolution.SetSize(1920, 1088);
+ // MediaCodec is only guaranteed to support the baseline profile.
+ profile.profile = media::H264PROFILE_BASELINE;
+ profile.min_resolution.SetSize(0, 0);
+ profile.max_resolution.SetSize(3840, 2160);
profiles.push_back(profile);
+
return profiles;
}
« no previous file with comments | « no previous file | content/renderer/media/rtc_video_decoder.cc » ('j') | content/renderer/media/rtc_video_decoder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698