Commit f8b28baa authored by Fredrik Hubinette's avatar Fredrik Hubinette Committed by Commit Bot

fix color assumption in webm parser

When we get a color tag that doesn't actually
specify the value range, we should not default
to full range values. Instead let's default to
INVALID (which later on defaults to limited range)

Bug: 827893
Change-Id: I137391651fea6b1bff05da20199ebbd8b6cc41e4
Reviewed-on: https://chromium-review.googlesource.com/990778
Commit-Queue: Fredrik Hubinette <hubbe@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548139}
parent f8a95994
......@@ -99,6 +99,9 @@ enum class Range : std::uint64_t {
Defined by MatrixCoefficients/TransferCharacteristics.
*/
kDerived = 3,
kMinValue = kUnspecified,
kMaxValue = kDerived,
};
/**
......@@ -413,10 +416,12 @@ WebMColorMetadata WebMColourParser::GetWebMColorMetadata() const {
if (chroma_siting_vert_ != -1)
color_metadata.ChromaSitingVert = chroma_siting_vert_;
gfx::ColorSpace::RangeID range_id = gfx::ColorSpace::RangeID::FULL;
gfx::ColorSpace::RangeID range_id = gfx::ColorSpace::RangeID::INVALID;
if (range_ >= static_cast<int64_t>(Range::kMinValue) &&
range_ <= static_cast<int64_t>(Range::kMaxValue)) {
switch (static_cast<Range>(range_)) {
case Range::kUnspecified:
range_id = gfx::ColorSpace::RangeID::FULL;
range_id = gfx::ColorSpace::RangeID::INVALID;
break;
case Range::kBroadcast:
range_id = gfx::ColorSpace::RangeID::LIMITED;
......@@ -428,6 +433,7 @@ WebMColorMetadata WebMColourParser::GetWebMColorMetadata() const {
range_id = gfx::ColorSpace::RangeID::DERIVED;
break;
}
}
color_metadata.color_space = VideoColorSpace(
primaries_, transfer_characteristics_, matrix_coefficients_, range_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment