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

Side by Side Diff: media/formats/webm/webm_stream_parser_unittest.cc

Issue 2333663003: Add color metadata info to VideoDecoderConfig. (Closed)
Patch Set: Commented the RangeID comment as suggested Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « media/formats/webm/webm_parser.cc ('k') | media/formats/webm/webm_video_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/webm/webm_stream_parser.h" 5 #include "media/formats/webm/webm_stream_parser.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "media/base/decoder_buffer.h" 10 #include "media/base/decoder_buffer.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 StreamParser::InitParameters params(kInfiniteDuration); 146 StreamParser::InitParameters params(kInfiniteDuration);
147 params.detected_audio_track_count = 1; 147 params.detected_audio_track_count = 1;
148 params.detected_video_track_count = 1; 148 params.detected_video_track_count = 1;
149 params.detected_text_track_count = 1; 149 params.detected_text_track_count = 1;
150 ParseWebMFile("bear-vp8-webvtt.webm", params); 150 ParseWebMFile("bear-vp8-webvtt.webm", params);
151 EXPECT_EQ(media_tracks_->tracks().size(), 2u); 151 EXPECT_EQ(media_tracks_->tracks().size(), 2u);
152 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video); 152 EXPECT_EQ(media_tracks_->tracks()[0]->type(), MediaTrack::Video);
153 EXPECT_EQ(media_tracks_->tracks()[1]->type(), MediaTrack::Audio); 153 EXPECT_EQ(media_tracks_->tracks()[1]->type(), MediaTrack::Audio);
154 } 154 }
155 155
156 TEST_F(WebMStreamParserTest, ColourElement) {
157 EXPECT_MEDIA_LOG(testing::HasSubstr("Estimating WebM block duration"))
158 .Times(testing::AnyNumber());
159 StreamParser::InitParameters params(kInfiniteDuration);
160 params.detected_audio_track_count = 0;
161 params.detected_video_track_count = 1;
162 params.detected_text_track_count = 0;
163 ParseWebMFile("colour.webm", params);
164 EXPECT_EQ(media_tracks_->tracks().size(), 1u);
165
166 const auto& video_track = media_tracks_->tracks()[0];
167 EXPECT_EQ(video_track->type(), MediaTrack::Video);
168
169 const VideoDecoderConfig& video_config =
170 media_tracks_->getVideoConfig(video_track->bytestream_track_id());
171
172 gfx::ColorSpace expected_color_space(gfx::ColorSpace::PrimaryID::SMPTEST428_1,
173 gfx::ColorSpace::TransferID::LOG,
174 gfx::ColorSpace::MatrixID::RGB,
175 gfx::ColorSpace::RangeID::FULL);
176 EXPECT_EQ(video_config.color_space_info(), expected_color_space);
177
178 base::Optional<HDRMetadata> hdr_metadata = video_config.hdr_metadata();
179 EXPECT_TRUE(hdr_metadata.has_value());
180 EXPECT_EQ(hdr_metadata->max_cll, 11u);
181 EXPECT_EQ(hdr_metadata->max_fall, 12u);
182
183 const MasteringMetadata& mmdata = hdr_metadata->mastering_metadata;
184 EXPECT_FLOAT_EQ(mmdata.primary_r_chromaticity_x, 0.1f);
185 EXPECT_FLOAT_EQ(mmdata.primary_r_chromaticity_y, 0.2f);
186 EXPECT_FLOAT_EQ(mmdata.primary_g_chromaticity_x, 0.1f);
187 EXPECT_FLOAT_EQ(mmdata.primary_g_chromaticity_y, 0.2f);
188 EXPECT_FLOAT_EQ(mmdata.primary_b_chromaticity_x, 0.1f);
189 EXPECT_FLOAT_EQ(mmdata.primary_b_chromaticity_y, 0.2f);
190 EXPECT_FLOAT_EQ(mmdata.white_point_chromaticity_x, 0.1f);
191 EXPECT_FLOAT_EQ(mmdata.white_point_chromaticity_y, 0.2f);
192 EXPECT_EQ(mmdata.luminance_max, 40);
193 EXPECT_EQ(mmdata.luminance_min, 30);
194 }
195
156 } // namespace media 196 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/webm/webm_parser.cc ('k') | media/formats/webm/webm_video_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698