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

Unified Diff: content/renderer/pepper/video_encoder_shim.cc

Issue 1769593002: Add 4 VP9 profiles to the media::VideoCodecProfile enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hevc-codec-7
Patch Set: Added some comments and dchecks Created 4 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
« no previous file with comments | « content/renderer/pepper/pepper_video_encoder_host.cc ('k') | gpu/config/gpu_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/video_encoder_shim.cc
diff --git a/content/renderer/pepper/video_encoder_shim.cc b/content/renderer/pepper/video_encoder_shim.cc
index 2684c89166ba82b80bd4de15d7e6dc222f074f81..c19e4b1b3a29b22b7a00ef3cdb299c4a9339809a 100644
--- a/content/renderer/pepper/video_encoder_shim.cc
+++ b/content/renderer/pepper/video_encoder_shim.cc
@@ -74,7 +74,9 @@ void GetVpxCodecParameters(media::VideoCodecProfile codec,
*max_quantizer = kVp8DefaultMaxQuantizer;
*cpu_used = kVp8DefaultCpuUsed;
break;
- case media::VP9PROFILE_ANY:
+ // Only VP9 profile 0 is supported by PPAPI at the moment. VP9 profiles 1-3
+ // are not supported due to backward compatibility.
+ case media::VP9PROFILE_PROFILE0:
*vpx_codec = vpx_codec_vp9_cx();
*min_quantizer = kVp9DefaultMinQuantizer;
*max_quantizer = kVp9DefaultMaxQuantizer;
@@ -165,6 +167,12 @@ void VideoEncoderShim::EncoderImpl::Initialize(
gfx::Size coded_size =
media::VideoFrame::PlaneSize(input_format, 0, input_visible_size);
+ // Only VP9 profile 0 is supported by PPAPI at the moment. VP9 profiles 1-3
+ // are not supported due to backward compatibility.
+ DCHECK_NE(output_profile, media::VP9PROFILE_PROFILE1);
+ DCHECK_NE(output_profile, media::VP9PROFILE_PROFILE2);
+ DCHECK_NE(output_profile, media::VP9PROFILE_PROFILE3);
+
vpx_codec_iface_t* vpx_codec;
int32_t min_quantizer, max_quantizer, cpu_used;
GetVpxCodecParameters(output_profile, &vpx_codec, &min_quantizer,
@@ -196,7 +204,7 @@ void VideoEncoderShim::EncoderImpl::Initialize(
// Use Q/CQ mode if no target bitrate is given. Note that in the VP8/CQ case
// the meaning of rc_target_bitrate changes to target maximum rate.
if (initial_bitrate == 0) {
- if (output_profile == media::VP9PROFILE_ANY) {
+ if (output_profile == media::VP9PROFILE_PROFILE0) {
config_.rc_end_usage = VPX_Q;
} else if (output_profile == media::VP8PROFILE_ANY) {
config_.rc_end_usage = VPX_CQ;
@@ -223,7 +231,7 @@ void VideoEncoderShim::EncoderImpl::Initialize(
return;
}
- if (output_profile == media::VP9PROFILE_ANY) {
+ if (output_profile == media::VP9PROFILE_PROFILE0) {
if (vpx_codec_control(&encoder_, VP9E_SET_AQ_MODE,
kVp9AqModeCyclicRefresh) != VPX_CODEC_OK) {
NotifyError(media::VideoEncodeAccelerator::kPlatformFailureError);
@@ -389,10 +397,10 @@ VideoEncoderShim::GetSupportedProfiles() {
ret = vpx_codec_enc_config_default(vpx_codec_vp9_cx(), &config, 0);
if (ret == VPX_CODEC_OK) {
media::VideoEncodeAccelerator::SupportedProfile profile;
- profile.profile = media::VP9PROFILE_ANY;
profile.max_resolution = gfx::Size(kMaxWidth, kMaxHeight);
profile.max_framerate_numerator = config.g_timebase.den;
profile.max_framerate_denominator = config.g_timebase.num;
+ profile.profile = media::VP9PROFILE_PROFILE0;
profiles.push_back(profile);
}
@@ -412,7 +420,7 @@ bool VideoEncoderShim::Initialize(
return false;
if (output_profile != media::VP8PROFILE_ANY &&
- output_profile != media::VP9PROFILE_ANY)
+ output_profile != media::VP9PROFILE_PROFILE0)
return false;
media_task_runner_->PostTask(
« no previous file with comments | « content/renderer/pepper/pepper_video_encoder_host.cc ('k') | gpu/config/gpu_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698