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

Side by Side Diff: media/filters/ffmpeg_video_decoder_unittest.cc

Issue 1221903003: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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/filters/ffmpeg_video_decoder.cc ('k') | media/filters/vpx_video_decoder.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <list> 5 #include <list>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 TEST_F(FFmpegVideoDecoderTest, Initialize_UnsupportedDecoder) { 218 TEST_F(FFmpegVideoDecoderTest, Initialize_UnsupportedDecoder) {
219 // Test avcodec_find_decoder() returning NULL. 219 // Test avcodec_find_decoder() returning NULL.
220 InitializeWithConfigWithResult(TestVideoConfig::Invalid(), false); 220 InitializeWithConfigWithResult(TestVideoConfig::Invalid(), false);
221 } 221 }
222 222
223 TEST_F(FFmpegVideoDecoderTest, Initialize_UnsupportedPixelFormat) { 223 TEST_F(FFmpegVideoDecoderTest, Initialize_UnsupportedPixelFormat) {
224 // Ensure decoder handles unsupported pixel formats without crashing. 224 // Ensure decoder handles unsupported pixel formats without crashing.
225 VideoDecoderConfig config(kCodecVP8, VIDEO_CODEC_PROFILE_UNKNOWN, 225 VideoDecoderConfig config(kCodecVP8, VIDEO_CODEC_PROFILE_UNKNOWN,
226 VideoFrame::UNKNOWN, 226 VideoFrame::UNKNOWN,
227 kCodedSize, kVisibleRect, kNaturalSize, 227 VideoFrame::COLOR_SPACE_UNSPECIFIED, kCodedSize,
228 NULL, 0, false); 228 kVisibleRect, kNaturalSize, NULL, 0, false);
229 InitializeWithConfigWithResult(config, false); 229 InitializeWithConfigWithResult(config, false);
230 } 230 }
231 231
232 TEST_F(FFmpegVideoDecoderTest, Initialize_OpenDecoderFails) { 232 TEST_F(FFmpegVideoDecoderTest, Initialize_OpenDecoderFails) {
233 // Specify Theora w/o extra data so that avcodec_open2() fails. 233 // Specify Theora w/o extra data so that avcodec_open2() fails.
234 VideoDecoderConfig config(kCodecTheora, VIDEO_CODEC_PROFILE_UNKNOWN, 234 VideoDecoderConfig config(kCodecTheora, VIDEO_CODEC_PROFILE_UNKNOWN,
235 kVideoFormat, 235 kVideoFormat, VideoFrame::COLOR_SPACE_UNSPECIFIED,
236 kCodedSize, kVisibleRect, kNaturalSize, 236 kCodedSize, kVisibleRect, kNaturalSize,
237 NULL, 0, false); 237 NULL, 0, false);
238 InitializeWithConfigWithResult(config, false); 238 InitializeWithConfigWithResult(config, false);
239 } 239 }
240 240
241 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorZero) { 241 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorZero) {
242 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 0, 1); 242 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 0, 1);
243 VideoDecoderConfig config(kCodecVP8, 243 VideoDecoderConfig config(kCodecVP8,
244 VP8PROFILE_ANY, 244 VP8PROFILE_ANY,
245 kVideoFormat, 245 kVideoFormat,
246 VideoFrame::COLOR_SPACE_UNSPECIFIED,
246 kCodedSize, 247 kCodedSize,
247 kVisibleRect, 248 kVisibleRect,
248 natural_size, 249 natural_size,
249 NULL, 250 NULL,
250 0, 251 0,
251 false); 252 false);
252 InitializeWithConfigWithResult(config, false); 253 InitializeWithConfigWithResult(config, false);
253 } 254 }
254 255
255 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorZero) { 256 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorZero) {
256 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, 0); 257 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, 0);
257 VideoDecoderConfig config(kCodecVP8, 258 VideoDecoderConfig config(kCodecVP8,
258 VP8PROFILE_ANY, 259 VP8PROFILE_ANY,
259 kVideoFormat, 260 kVideoFormat,
261 VideoFrame::COLOR_SPACE_UNSPECIFIED,
260 kCodedSize, 262 kCodedSize,
261 kVisibleRect, 263 kVisibleRect,
262 natural_size, 264 natural_size,
263 NULL, 265 NULL,
264 0, 266 0,
265 false); 267 false);
266 InitializeWithConfigWithResult(config, false); 268 InitializeWithConfigWithResult(config, false);
267 } 269 }
268 270
269 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorNegative) { 271 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorNegative) {
270 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), -1, 1); 272 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), -1, 1);
271 VideoDecoderConfig config(kCodecVP8, 273 VideoDecoderConfig config(kCodecVP8,
272 VP8PROFILE_ANY, 274 VP8PROFILE_ANY,
273 kVideoFormat, 275 kVideoFormat,
276 VideoFrame::COLOR_SPACE_UNSPECIFIED,
274 kCodedSize, 277 kCodedSize,
275 kVisibleRect, 278 kVisibleRect,
276 natural_size, 279 natural_size,
277 NULL, 280 NULL,
278 0, 281 0,
279 false); 282 false);
280 InitializeWithConfigWithResult(config, false); 283 InitializeWithConfigWithResult(config, false);
281 } 284 }
282 285
283 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorNegative) { 286 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorNegative) {
284 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, -1); 287 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, -1);
285 VideoDecoderConfig config(kCodecVP8, 288 VideoDecoderConfig config(kCodecVP8,
286 VP8PROFILE_ANY, 289 VP8PROFILE_ANY,
287 kVideoFormat, 290 kVideoFormat,
291 VideoFrame::COLOR_SPACE_UNSPECIFIED,
288 kCodedSize, 292 kCodedSize,
289 kVisibleRect, 293 kVisibleRect,
290 natural_size, 294 natural_size,
291 NULL, 295 NULL,
292 0, 296 0,
293 false); 297 false);
294 InitializeWithConfigWithResult(config, false); 298 InitializeWithConfigWithResult(config, false);
295 } 299 }
296 300
297 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorTooLarge) { 301 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorTooLarge) {
298 int width = kVisibleRect.size().width(); 302 int width = kVisibleRect.size().width();
299 int num = ceil(static_cast<double>(limits::kMaxDimension + 1) / width); 303 int num = ceil(static_cast<double>(limits::kMaxDimension + 1) / width);
300 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), num, 1); 304 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), num, 1);
301 VideoDecoderConfig config(kCodecVP8, 305 VideoDecoderConfig config(kCodecVP8,
302 VP8PROFILE_ANY, 306 VP8PROFILE_ANY,
303 kVideoFormat, 307 kVideoFormat,
308 VideoFrame::COLOR_SPACE_UNSPECIFIED,
304 kCodedSize, 309 kCodedSize,
305 kVisibleRect, 310 kVisibleRect,
306 natural_size, 311 natural_size,
307 NULL, 312 NULL,
308 0, 313 0,
309 false); 314 false);
310 InitializeWithConfigWithResult(config, false); 315 InitializeWithConfigWithResult(config, false);
311 } 316 }
312 317
313 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorTooLarge) { 318 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorTooLarge) {
314 int den = kVisibleRect.size().width() + 1; 319 int den = kVisibleRect.size().width() + 1;
315 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, den); 320 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, den);
316 VideoDecoderConfig config(kCodecVP8, 321 VideoDecoderConfig config(kCodecVP8,
317 VP8PROFILE_ANY, 322 VP8PROFILE_ANY,
318 kVideoFormat, 323 kVideoFormat,
324 VideoFrame::COLOR_SPACE_UNSPECIFIED,
319 kCodedSize, 325 kCodedSize,
320 kVisibleRect, 326 kVisibleRect,
321 natural_size, 327 natural_size,
322 NULL, 328 NULL,
323 0, 329 0,
324 false); 330 false);
325 InitializeWithConfigWithResult(config, false); 331 InitializeWithConfigWithResult(config, false);
326 } 332 }
327 333
328 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Normal) { 334 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Normal) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 469
464 // Test destruction when decoder has hit end of stream. 470 // Test destruction when decoder has hit end of stream.
465 TEST_F(FFmpegVideoDecoderTest, Destroy_EndOfStream) { 471 TEST_F(FFmpegVideoDecoderTest, Destroy_EndOfStream) {
466 Initialize(); 472 Initialize();
467 EnterDecodingState(); 473 EnterDecodingState();
468 EnterEndOfStreamState(); 474 EnterEndOfStreamState();
469 Destroy(); 475 Destroy();
470 } 476 }
471 477
472 } // namespace media 478 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder.cc ('k') | media/filters/vpx_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698