Index: media/base/video_decoder_config.cc |
diff --git a/media/base/video_decoder_config.cc b/media/base/video_decoder_config.cc |
index ee334d3bd3eed24abfe8845719589c9f84928846..07bf9a56e878dcf533a9e33a4150242038dac23d 100644 |
--- a/media/base/video_decoder_config.cc |
+++ b/media/base/video_decoder_config.cc |
@@ -14,6 +14,7 @@ namespace media { |
VideoDecoderConfig::VideoDecoderConfig() |
: codec_(kUnknownVideoCodec), |
+ profile_(VIDEO_CODEC_PROFILE_UNKNOWN), |
format_(VideoFrame::INVALID), |
frame_rate_numerator_(0), |
frame_rate_denominator_(0), |
@@ -23,6 +24,7 @@ VideoDecoderConfig::VideoDecoderConfig() |
} |
VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec, |
+ VideoCodecProfile profile, |
VideoFrame::Format format, |
const gfx::Size& coded_size, |
const gfx::Rect& visible_rect, |
@@ -32,7 +34,7 @@ VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec, |
int aspect_ratio_denominator, |
const uint8* extra_data, |
size_t extra_data_size) { |
- Initialize(codec, format, coded_size, visible_rect, |
+ Initialize(codec, profile, format, coded_size, visible_rect, |
frame_rate_numerator, frame_rate_denominator, |
aspect_ratio_numerator, aspect_ratio_denominator, |
extra_data, extra_data_size); |
@@ -62,7 +64,9 @@ static void UmaHistogramAspectRatio(const char* name, const T& size) { |
kCommonAspectRatios100, arraysize(kCommonAspectRatios100))); |
} |
-void VideoDecoderConfig::Initialize(VideoCodec codec, VideoFrame::Format format, |
+void VideoDecoderConfig::Initialize(VideoCodec codec, |
+ VideoCodecProfile profile, |
+ VideoFrame::Format format, |
const gfx::Size& coded_size, |
const gfx::Rect& visible_rect, |
int frame_rate_numerator, |
@@ -74,12 +78,15 @@ void VideoDecoderConfig::Initialize(VideoCodec codec, VideoFrame::Format format, |
CHECK((extra_data_size != 0) == (extra_data != NULL)); |
UMA_HISTOGRAM_ENUMERATION("Media.VideoCodec", codec, kVideoCodecMax + 1); |
+ UMA_HISTOGRAM_ENUMERATION("Media.VideoCodecProfile", profile, |
+ VIDEO_CODEC_PROFILE_MAX + 1); |
UMA_HISTOGRAM_COUNTS_10000("Media.VideoCodedWidth", coded_size.width()); |
UmaHistogramAspectRatio("Media.VideoCodedAspectRatio", coded_size); |
UMA_HISTOGRAM_COUNTS_10000("Media.VideoVisibleWidth", visible_rect.width()); |
UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect); |
codec_ = codec; |
+ profile_ = profile; |
format_ = format; |
coded_size_ = coded_size; |
visible_rect_ = visible_rect; |
@@ -125,10 +132,33 @@ bool VideoDecoderConfig::IsValidConfig() const { |
natural_size_.GetArea() <= limits::kMaxCanvas; |
} |
+std::string VideoDecoderConfig::AsHumanReadableString() const { |
+ std::ostringstream s; |
+ s << "codec: " << codec() |
+ << " format: " << format() |
+ << " coded size: [" << coded_size().width() |
+ << "," << coded_size().height() << "]" |
+ << " visible rect: [" << visible_rect().x() |
+ << "," << visible_rect().y() |
+ << "," << visible_rect().width() |
+ << "," << visible_rect().height() << "]" |
+ << " natural size: [" << natural_size().width() |
+ << "," << natural_size().height() << "]" |
+ << " frame rate: " << frame_rate_numerator() |
+ << "/" << frame_rate_denominator() |
+ << " aspect ratio: " << aspect_ratio_numerator() |
+ << "/" << aspect_ratio_denominator(); |
+ return s.str(); |
+} |
+ |
VideoCodec VideoDecoderConfig::codec() const { |
return codec_; |
} |
+VideoCodecProfile VideoDecoderConfig::profile() const { |
+ return profile_; |
+} |
+ |
VideoFrame::Format VideoDecoderConfig::format() const { |
return format_; |
} |