summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authoramineer <amineer@google.com>2015-07-09 13:20:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-09 20:20:59 +0000
commite735fb0c4b13b72561b8f9931a8788e97deced33 (patch)
treeb1835de9888be97bf730c4be243e30ab0ef91cbe /media/base
parente08618ef94f9f536c3fa548abfae85211632dedf (diff)
downloadchromium_src-e735fb0c4b13b72561b8f9931a8788e97deced33.zip
chromium_src-e735fb0c4b13b72561b8f9931a8788e97deced33.tar.gz
chromium_src-e735fb0c4b13b72561b8f9931a8788e97deced33.tar.bz2
Revert of Change the video color space default. (patchset #4 id:60001 of https://codereview.chromium.org/1221903003/)
Reason for revert: Causing official continuous builds to fail with the following: ../../media/cast/sender/h264_vt_encoder_unittest.cc:308:22: error: no matching constructor for initialization of 'media::VideoDecoderConfig' VideoDecoderConfig config(kCodecH264, H264PROFILE_MAIN, frame_->format(), ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../media/base/video_decoder_config.h:78:3: note: candidate constructor not viable: requires 10 arguments, but 9 were provided VideoDecoderConfig(VideoCodec codec, ^ ../../media/base/video_decoder_config.h:70:20: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 9 were provided class MEDIA_EXPORT VideoDecoderConfig { ^ ../../media/base/video_decoder_config.h:74:3: note: candidate constructor not viable: requires 0 arguments, but 9 were provided VideoDecoderConfig(); ^ 1 error generated. Original issue's description: > Change the video color space default. > > Previously video without color space metadata was assumed to be in > Rec601. Now the default depends on the kind of playback. Normal src= > defaults to Rec601 for SD sized video (<720 pixels high), and Rec709 for > HD. MSE will always default to Rec709. Using a size based heuristic > doesn't make sense for MSE where it is common for the resolution to > change mid playback. > > This CL doesn't change the meaning of COLOR_SPACE_UNSPECIFIED. Instead, > it adds a color space field to VideoDecoderConfig, and updates the video > decoders to use this as the default if they don't find a more > authoritative value in the bitstream. > > This also fixes a (year old!) bug causing the blackwhite > tests to always succeed, renames the rec709 blackwhite test > file to match the name in blackwhite.html, and re-encodes it > to contain the color space metadata (previously it had none). > > BUG=333619 > > Committed: https://crrev.com/4dc6c2ad0e595a5e0b543e8e1b8961ee0d742a32 > Cr-Commit-Position: refs/heads/master@{#338110} TBR=dalecurtis@chromium.org,bbudge@chromium.org,codebythepound@gmail.com,gunsch@chromium.org,lcwu@chromium.org,watk@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=333619 Review URL: https://codereview.chromium.org/1228843003 Cr-Commit-Position: refs/heads/master@{#338124}
Diffstat (limited to 'media/base')
-rw-r--r--media/base/test_helpers.cc5
-rw-r--r--media/base/video_decoder_config.cc36
-rw-r--r--media/base/video_decoder_config.h23
-rw-r--r--media/base/video_frame.h6
4 files changed, 46 insertions, 24 deletions
diff --git a/media/base/test_helpers.cc b/media/base/test_helpers.cc
index 2b108ff..f4ba991 100644
--- a/media/base/test_helpers.cc
+++ b/media/base/test_helpers.cc
@@ -126,9 +126,8 @@ static VideoDecoderConfig GetTestConfig(VideoCodec codec,
gfx::Size natural_size = coded_size;
return VideoDecoderConfig(codec, VIDEO_CODEC_PROFILE_UNKNOWN,
- VideoFrame::YV12,
- VideoFrame::COLOR_SPACE_UNSPECIFIED, coded_size,
- visible_rect, natural_size, NULL, 0, is_encrypted);
+ VideoFrame::YV12, coded_size, visible_rect, natural_size,
+ NULL, 0, is_encrypted);
}
static const gfx::Size kNormalSize(320, 240);
diff --git a/media/base/video_decoder_config.cc b/media/base/video_decoder_config.cc
index fd57933..8825e2d 100644
--- a/media/base/video_decoder_config.cc
+++ b/media/base/video_decoder_config.cc
@@ -19,14 +19,13 @@ VideoDecoderConfig::VideoDecoderConfig()
VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
VideoCodecProfile profile,
VideoFrame::Format format,
- VideoFrame::ColorSpace color_space,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
const uint8* extra_data,
size_t extra_data_size,
bool is_encrypted) {
- Initialize(codec, profile, format, color_space,
+ Initialize(codec, profile, format, VideoFrame::COLOR_SPACE_UNSPECIFIED,
coded_size, visible_rect, natural_size, extra_data,
extra_data_size, is_encrypted, true);
}
@@ -88,7 +87,6 @@ void VideoDecoderConfig::Initialize(VideoCodec codec,
codec_ = codec;
profile_ = profile;
format_ = format;
- color_space_ = color_space;
coded_size_ = coded_size;
visible_rect_ = visible_rect;
natural_size_ = natural_size;
@@ -159,10 +157,42 @@ std::string VideoDecoderConfig::GetHumanReadableCodecName() const {
return "";
}
+VideoCodec VideoDecoderConfig::codec() const {
+ return codec_;
+}
+
+VideoCodecProfile VideoDecoderConfig::profile() const {
+ return profile_;
+}
+
+VideoFrame::Format VideoDecoderConfig::format() const {
+ return format_;
+}
+
+gfx::Size VideoDecoderConfig::coded_size() const {
+ return coded_size_;
+}
+
+gfx::Rect VideoDecoderConfig::visible_rect() const {
+ return visible_rect_;
+}
+
+gfx::Size VideoDecoderConfig::natural_size() const {
+ return natural_size_;
+}
+
const uint8* VideoDecoderConfig::extra_data() const {
if (extra_data_.empty())
return NULL;
return &extra_data_[0];
}
+size_t VideoDecoderConfig::extra_data_size() const {
+ return extra_data_.size();
+}
+
+bool VideoDecoderConfig::is_encrypted() const {
+ return is_encrypted_;
+}
+
} // namespace media
diff --git a/media/base/video_decoder_config.h b/media/base/video_decoder_config.h
index d586a78..00de84e 100644
--- a/media/base/video_decoder_config.h
+++ b/media/base/video_decoder_config.h
@@ -78,7 +78,6 @@ class MEDIA_EXPORT VideoDecoderConfig {
VideoDecoderConfig(VideoCodec codec,
VideoCodecProfile profile,
VideoFrame::Format format,
- VideoFrame::ColorSpace color_space,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
@@ -113,44 +112,38 @@ class MEDIA_EXPORT VideoDecoderConfig {
std::string GetHumanReadableCodecName() const;
- VideoCodec codec() const { return codec_; }
- VideoCodecProfile profile() const { return profile_; }
+ VideoCodec codec() const;
+ VideoCodecProfile profile() const;
// Video format used to determine YUV buffer sizes.
- VideoFrame::Format format() const { return format_; }
-
- // The default color space of the decoded frames. Decoders should output
- // frames tagged with this color space unless they find a different value in
- // the bitstream.
- VideoFrame::ColorSpace color_space() const { return color_space_; }
+ VideoFrame::Format format() const;
// Width and height of video frame immediately post-decode. Not all pixels
// in this region are valid.
- gfx::Size coded_size() const { return coded_size_; }
+ gfx::Size coded_size() const;
// Region of |coded_size_| that is visible.
- gfx::Rect visible_rect() const { return visible_rect_; }
+ gfx::Rect visible_rect() const;
// Final visible width and height of a video frame with aspect ratio taken
// into account.
- gfx::Size natural_size() const { return natural_size_; }
+ gfx::Size natural_size() const;
// Optional byte data required to initialize video decoders, such as H.264
// AAVC data.
const uint8* extra_data() const;
- size_t extra_data_size() const { return extra_data_.size(); }
+ size_t extra_data_size() const;
// Whether the video stream is potentially encrypted.
// Note that in a potentially encrypted video stream, individual buffers
// can be encrypted or not encrypted.
- bool is_encrypted() const { return is_encrypted_; }
+ bool is_encrypted() const;
private:
VideoCodec codec_;
VideoCodecProfile profile_;
VideoFrame::Format format_;
- VideoFrame::ColorSpace color_space_;
gfx::Size coded_size_;
gfx::Rect visible_rect_;
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index b97ee1b..2588e46 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -62,14 +62,14 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
FORMAT_MAX = XRGB, // Must always be equal to largest entry logged.
};
- // Color space or color range used for the pixels.
+ // Color space or color range used for the pixels, in general this is left
+ // unspecified, meaning Rec601 (SD) is assumed.
// Logged to UMA, so never reuse values. Leave gaps if necessary.
enum ColorSpace {
COLOR_SPACE_UNSPECIFIED = 0, // In general this is Rec601.
COLOR_SPACE_JPEG = 1, // JPEG color range.
COLOR_SPACE_HD_REC709 = 2, // Rec709 "HD" color space.
- COLOR_SPACE_SD_REC601 = 3, // Rec601 "SD" color space.
- COLOR_SPACE_MAX = COLOR_SPACE_SD_REC601,
+ COLOR_SPACE_MAX = COLOR_SPACE_HD_REC709,
};
// Defines the pixel storage type. Differentiates between directly accessible