Chromium Code Reviews| 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; |
| } |