Using PROFILE_ANY for vp8 and vp9
VP8 and VP9 do not take profile into account. Using PROFILE_MAIN is confusing. This patch uses PROFILE_ANY for these codecs. TBR=noelallen@chromium.org BUG=361676 Review URL: https://codereview.chromium.org/418193003 Cr-Commit-Position: refs/heads/master@{#289765} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289765 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
content
common
gpu
renderer
media
base
cast
ffmpeg
filters
formats
native_client_sdk/src/examples/api/video_decode
ppapi
api
c
examples
video_decode
tests
@ -89,7 +89,7 @@ bool AndroidVideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
|
||||
|
||||
client_ = client;
|
||||
|
||||
if (profile == media::VP8PROFILE_MAIN) {
|
||||
if (profile == media::VP8PROFILE_ANY) {
|
||||
codec_ = media::kCodecVP8;
|
||||
} else {
|
||||
// TODO(dwkang): enable H264 once b/8125974 is fixed.
|
||||
|
@ -100,7 +100,7 @@ AndroidVideoEncodeAccelerator::GetSupportedProfiles() {
|
||||
continue;
|
||||
}
|
||||
SupportedProfile profile;
|
||||
profile.profile = media::VP8PROFILE_MAIN;
|
||||
profile.profile = media::VP8PROFILE_ANY;
|
||||
// Wouldn't it be nice if MediaCodec exposed the maximum capabilities of the
|
||||
// encoder? Sure would be. Too bad it doesn't. So we hard-code some
|
||||
// reasonable defaults.
|
||||
@ -129,7 +129,7 @@ bool AndroidVideoEncodeAccelerator::Initialize(
|
||||
|
||||
if (!(media::MediaCodecBridge::SupportsSetParameters() &&
|
||||
format == VideoFrame::I420 &&
|
||||
output_profile == media::VP8PROFILE_MAIN)) {
|
||||
output_profile == media::VP8PROFILE_ANY)) {
|
||||
DLOG(ERROR) << "Unexpected combo: " << format << ", " << output_profile;
|
||||
return false;
|
||||
}
|
||||
|
@ -224,8 +224,8 @@ bool V4L2VideoDecodeAccelerator::Initialize(media::VideoCodecProfile profile,
|
||||
case media::H264PROFILE_HIGH:
|
||||
DVLOG(2) << "Initialize(): profile H264PROFILE_HIGH";
|
||||
break;
|
||||
case media::VP8PROFILE_MAIN:
|
||||
DVLOG(2) << "Initialize(): profile VP8PROFILE_MAIN";
|
||||
case media::VP8PROFILE_ANY:
|
||||
DVLOG(2) << "Initialize(): profile VP8PROFILE_ANY";
|
||||
break;
|
||||
default:
|
||||
DLOG(ERROR) << "Initialize(): unsupported profile=" << profile;
|
||||
|
@ -288,7 +288,7 @@ V4L2VideoEncodeAccelerator::GetSupportedProfiles() {
|
||||
|
||||
const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
|
||||
if (cmd_line->HasSwitch(switches::kEnableWebRtcHWVp8Encoding)) {
|
||||
profile.profile = media::VP8PROFILE_MAIN;
|
||||
profile.profile = media::VP8PROFILE_ANY;
|
||||
profile.max_resolution.SetSize(1920, 1088);
|
||||
profile.max_framerate.numerator = 30;
|
||||
profile.max_framerate.denominator = 1;
|
||||
|
@ -118,7 +118,7 @@ scoped_ptr<RTCVideoDecoder> RTCVideoDecoder::Create(
|
||||
media::VideoCodecProfile profile;
|
||||
switch (type) {
|
||||
case webrtc::kVideoCodecVP8:
|
||||
profile = media::VP8PROFILE_MAIN;
|
||||
profile = media::VP8PROFILE_ANY;
|
||||
break;
|
||||
default:
|
||||
DVLOG(2) << "Video codec not supported:" << type;
|
||||
|
@ -48,7 +48,7 @@ media::VideoCodecProfile WebRTCCodecToVideoCodecProfile(
|
||||
webrtc::VideoCodecType type) {
|
||||
switch (type) {
|
||||
case webrtc::kVideoCodecVP8:
|
||||
return media::VP8PROFILE_MAIN;
|
||||
return media::VP8PROFILE_ANY;
|
||||
case webrtc::kVideoCodecGeneric:
|
||||
return media::H264PROFILE_MAIN;
|
||||
default:
|
||||
|
@ -161,10 +161,8 @@ PP_VideoCodec MediaVideoCodecToPpVideoCodec(media::VideoCodec codec) {
|
||||
PP_VideoCodecProfile MediaVideoCodecProfileToPpVideoCodecProfile(
|
||||
media::VideoCodecProfile profile) {
|
||||
switch (profile) {
|
||||
// TODO(xhwang): VP8 and VP9 do not have profiles. Clean up
|
||||
// media::VideoCodecProfile and remove these two cases.
|
||||
case media::VP8PROFILE_MAIN:
|
||||
case media::VP9PROFILE_MAIN:
|
||||
case media::VP8PROFILE_ANY:
|
||||
case media::VP9PROFILE_ANY:
|
||||
return PP_VIDEOCODECPROFILE_NOT_NEEDED;
|
||||
case media::H264PROFILE_BASELINE:
|
||||
return PP_VIDEOCODECPROFILE_H264_BASELINE;
|
||||
|
@ -53,10 +53,10 @@ media::VideoCodecProfile PepperToMediaVideoProfile(PP_VideoProfile profile) {
|
||||
return media::H264PROFILE_STEREOHIGH;
|
||||
case PP_VIDEOPROFILE_H264MULTIVIEWHIGH:
|
||||
return media::H264PROFILE_MULTIVIEWHIGH;
|
||||
case PP_VIDEOPROFILE_VP8MAIN:
|
||||
return media::VP8PROFILE_MAIN;
|
||||
case PP_VIDEOPROFILE_VP9MAIN:
|
||||
return media::VP9PROFILE_MAIN;
|
||||
case PP_VIDEOPROFILE_VP8_ANY:
|
||||
return media::VP8PROFILE_ANY;
|
||||
case PP_VIDEOPROFILE_VP9_ANY:
|
||||
return media::VP9PROFILE_ANY;
|
||||
// No default case, to catch unhandled PP_VideoProfile values.
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ media::VideoCodecProfile PPToMediaProfile(
|
||||
return media::H264PROFILE_STEREOHIGH;
|
||||
case PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH:
|
||||
return media::H264PROFILE_MULTIVIEWHIGH;
|
||||
case PP_VIDEODECODER_VP8PROFILE_MAIN:
|
||||
return media::VP8PROFILE_MAIN;
|
||||
case PP_VIDEODECODER_VP8PROFILE_ANY:
|
||||
return media::VP8PROFILE_ANY;
|
||||
default:
|
||||
return media::VIDEO_CODEC_PROFILE_UNKNOWN;
|
||||
}
|
||||
|
@ -58,11 +58,11 @@ enum VideoCodecProfile {
|
||||
H264PROFILE_MULTIVIEWHIGH = 10,
|
||||
H264PROFILE_MAX = H264PROFILE_MULTIVIEWHIGH,
|
||||
VP8PROFILE_MIN = 11,
|
||||
VP8PROFILE_MAIN = VP8PROFILE_MIN,
|
||||
VP8PROFILE_MAX = VP8PROFILE_MAIN,
|
||||
VP8PROFILE_ANY = VP8PROFILE_MIN,
|
||||
VP8PROFILE_MAX = VP8PROFILE_ANY,
|
||||
VP9PROFILE_MIN = 12,
|
||||
VP9PROFILE_MAIN = VP9PROFILE_MIN,
|
||||
VP9PROFILE_MAX = VP9PROFILE_MAIN,
|
||||
VP9PROFILE_ANY = VP9PROFILE_MIN,
|
||||
VP9PROFILE_MAX = VP9PROFILE_ANY,
|
||||
VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_MAX,
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ class LocalVideoEncodeAcceleratorClient
|
||||
VideoCodecProfile output_profile = media::VIDEO_CODEC_PROFILE_UNKNOWN;
|
||||
switch (video_config.codec) {
|
||||
case CODEC_VIDEO_VP8:
|
||||
output_profile = media::VP8PROFILE_MAIN;
|
||||
output_profile = media::VP8PROFILE_ANY;
|
||||
break;
|
||||
case CODEC_VIDEO_H264:
|
||||
output_profile = media::H264PROFILE_MAIN;
|
||||
|
@ -38,7 +38,7 @@ bool FakeVideoEncodeAccelerator::Initialize(
|
||||
uint32 initial_bitrate,
|
||||
Client* client) {
|
||||
client_ = client;
|
||||
if (output_profile != media::VP8PROFILE_MAIN &&
|
||||
if (output_profile != media::VP8PROFILE_ANY &&
|
||||
output_profile != media::H264PROFILE_MAIN) {
|
||||
return false;
|
||||
}
|
||||
|
@ -382,9 +382,9 @@ void AVStreamToVideoDecoderConfig(
|
||||
|
||||
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
|
||||
if (codec == kCodecVP8)
|
||||
profile = VP8PROFILE_MAIN;
|
||||
profile = VP8PROFILE_ANY;
|
||||
else if (codec == kCodecVP9)
|
||||
profile = VP9PROFILE_MAIN;
|
||||
profile = VP9PROFILE_ANY;
|
||||
else
|
||||
profile = ProfileIDToVideoCodecProfile(stream->codec->profile);
|
||||
|
||||
|
@ -242,37 +242,57 @@ TEST_F(FFmpegVideoDecoderTest, Initialize_OpenDecoderFails) {
|
||||
|
||||
TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorZero) {
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 0, 1);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorZero) {
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, 0);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorNegative) {
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), -1, 1);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorNegative) {
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, -1);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
@ -280,20 +300,30 @@ TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorTooLarge) {
|
||||
int width = kVisibleRect.size().width();
|
||||
int num = ceil(static_cast<double>(limits::kMaxDimension + 1) / width);
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), num, 1);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorTooLarge) {
|
||||
int den = kVisibleRect.size().width() + 1;
|
||||
gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, den);
|
||||
VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN,
|
||||
VideoDecoderConfig config(kCodecVP8,
|
||||
VP8PROFILE_ANY,
|
||||
kVideoFormat,
|
||||
kCodedSize, kVisibleRect, natural_size,
|
||||
NULL, 0, false);
|
||||
kCodedSize,
|
||||
kVisibleRect,
|
||||
natural_size,
|
||||
NULL,
|
||||
0,
|
||||
false);
|
||||
InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,10 @@ bool WebMVideoClient::InitializeConfig(
|
||||
VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN;
|
||||
if (codec_id == "V_VP8") {
|
||||
video_codec = kCodecVP8;
|
||||
profile = VP8PROFILE_MAIN;
|
||||
profile = VP8PROFILE_ANY;
|
||||
} else if (codec_id == "V_VP9") {
|
||||
video_codec = kCodecVP9;
|
||||
profile = VP9PROFILE_MAIN;
|
||||
profile = VP9PROFILE_ANY;
|
||||
} else {
|
||||
MEDIA_LOG(log_cb_) << "Unsupported video codec_id " << codec_id;
|
||||
return false;
|
||||
|
@ -246,7 +246,7 @@ Decoder::Decoder(MyInstance* instance,
|
||||
pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE));
|
||||
|
||||
#if defined USE_VP8_TESTDATA_INSTEAD_OF_H264
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_VP8MAIN;
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_VP8_ANY;
|
||||
#else
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_H264MAIN;
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@ enum PP_VideoDecoder_Profile {
|
||||
PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH = 9,
|
||||
PP_VIDEODECODER_H264PROFILE_STEREOHIGH = 10,
|
||||
PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH = 11,
|
||||
PP_VIDEODECODER_VP8PROFILE_MAIN = 12
|
||||
PP_VIDEODECODER_VP8PROFILE_ANY = 12
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -18,9 +18,9 @@ enum PP_VideoProfile {
|
||||
PP_VIDEOPROFILE_H264SCALABLEHIGH = 8,
|
||||
PP_VIDEOPROFILE_H264STEREOHIGH = 9,
|
||||
PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10,
|
||||
PP_VIDEOPROFILE_VP8MAIN = 11,
|
||||
PP_VIDEOPROFILE_VP9MAIN = 12,
|
||||
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9MAIN
|
||||
PP_VIDEOPROFILE_VP8_ANY = 11,
|
||||
PP_VIDEOPROFILE_VP9_ANY = 12,
|
||||
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ typedef enum {
|
||||
PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH = 9,
|
||||
PP_VIDEODECODER_H264PROFILE_STEREOHIGH = 10,
|
||||
PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH = 11,
|
||||
PP_VIDEODECODER_VP8PROFILE_MAIN = 12
|
||||
PP_VIDEODECODER_VP8PROFILE_ANY = 12
|
||||
} PP_VideoDecoder_Profile;
|
||||
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecoder_Profile, 4);
|
||||
/**
|
||||
|
@ -34,9 +34,9 @@ typedef enum {
|
||||
PP_VIDEOPROFILE_H264SCALABLEHIGH = 8,
|
||||
PP_VIDEOPROFILE_H264STEREOHIGH = 9,
|
||||
PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10,
|
||||
PP_VIDEOPROFILE_VP8MAIN = 11,
|
||||
PP_VIDEOPROFILE_VP9MAIN = 12,
|
||||
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9MAIN
|
||||
PP_VIDEOPROFILE_VP8_ANY = 11,
|
||||
PP_VIDEOPROFILE_VP9_ANY = 12,
|
||||
PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY
|
||||
} PP_VideoProfile;
|
||||
/**
|
||||
* @}
|
||||
|
@ -247,7 +247,7 @@ Decoder::Decoder(MyInstance* instance,
|
||||
pp::Module::Get()->GetBrowserInterface(PPB_CORE_INTERFACE));
|
||||
|
||||
#if defined USE_VP8_TESTDATA_INSTEAD_OF_H264
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_VP8MAIN;
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_VP8_ANY;
|
||||
#else
|
||||
const PP_VideoProfile kBitstreamProfile = PP_VIDEOPROFILE_H264MAIN;
|
||||
#endif
|
||||
|
@ -38,7 +38,7 @@ std::string TestVideoDecoder::TestCreate() {
|
||||
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
|
||||
pp::Graphics3D null_graphics_3d;
|
||||
callback.WaitForResult(video_decoder.Initialize(null_graphics_3d,
|
||||
PP_VIDEOPROFILE_VP8MAIN,
|
||||
PP_VIDEOPROFILE_VP8_ANY,
|
||||
kAllowSoftwareFallback,
|
||||
callback.GetCallback()));
|
||||
ASSERT_EQ(PP_ERROR_BADRESOURCE, callback.result());
|
||||
@ -60,7 +60,7 @@ std::string TestVideoDecoder::TestCreate() {
|
||||
pp::VideoDecoder video_decoder(instance_);
|
||||
TestCompletionCallback callback(instance_->pp_instance(), callback_type());
|
||||
callback.WaitForResult(video_decoder.Initialize(graphics_3d_,
|
||||
PP_VIDEOPROFILE_VP8MAIN,
|
||||
PP_VIDEOPROFILE_VP8_ANY,
|
||||
kAllowSoftwareFallback,
|
||||
callback.GetCallback()));
|
||||
ASSERT_EQ(PP_OK, callback.result());
|
||||
|
Reference in New Issue
Block a user