| OLD | NEW |
| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // Specify Theora w/o extra data so that avcodec_open2() fails. | 235 // Specify Theora w/o extra data so that avcodec_open2() fails. |
| 236 VideoDecoderConfig config(kCodecTheora, VIDEO_CODEC_PROFILE_UNKNOWN, | 236 VideoDecoderConfig config(kCodecTheora, VIDEO_CODEC_PROFILE_UNKNOWN, |
| 237 kVideoFormat, | 237 kVideoFormat, |
| 238 kCodedSize, kVisibleRect, kNaturalSize, | 238 kCodedSize, kVisibleRect, kNaturalSize, |
| 239 NULL, 0, false); | 239 NULL, 0, false); |
| 240 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 240 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 241 } | 241 } |
| 242 | 242 |
| 243 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorZero) { | 243 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorZero) { |
| 244 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 0, 1); | 244 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 0, 1); |
| 245 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 245 VideoDecoderConfig config(kCodecVP8, |
| 246 VP8PROFILE_ANY, |
| 246 kVideoFormat, | 247 kVideoFormat, |
| 247 kCodedSize, kVisibleRect, natural_size, | 248 kCodedSize, |
| 248 NULL, 0, false); | 249 kVisibleRect, |
| 250 natural_size, |
| 251 NULL, |
| 252 0, |
| 253 false); |
| 249 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 254 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 250 } | 255 } |
| 251 | 256 |
| 252 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorZero) { | 257 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorZero) { |
| 253 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, 0); | 258 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, 0); |
| 254 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 259 VideoDecoderConfig config(kCodecVP8, |
| 260 VP8PROFILE_ANY, |
| 255 kVideoFormat, | 261 kVideoFormat, |
| 256 kCodedSize, kVisibleRect, natural_size, | 262 kCodedSize, |
| 257 NULL, 0, false); | 263 kVisibleRect, |
| 264 natural_size, |
| 265 NULL, |
| 266 0, |
| 267 false); |
| 258 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 268 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 259 } | 269 } |
| 260 | 270 |
| 261 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorNegative) { | 271 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorNegative) { |
| 262 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), -1, 1); | 272 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), -1, 1); |
| 263 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 273 VideoDecoderConfig config(kCodecVP8, |
| 274 VP8PROFILE_ANY, |
| 264 kVideoFormat, | 275 kVideoFormat, |
| 265 kCodedSize, kVisibleRect, natural_size, | 276 kCodedSize, |
| 266 NULL, 0, false); | 277 kVisibleRect, |
| 278 natural_size, |
| 279 NULL, |
| 280 0, |
| 281 false); |
| 267 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 282 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 268 } | 283 } |
| 269 | 284 |
| 270 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorNegative) { | 285 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorNegative) { |
| 271 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, -1); | 286 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, -1); |
| 272 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 287 VideoDecoderConfig config(kCodecVP8, |
| 288 VP8PROFILE_ANY, |
| 273 kVideoFormat, | 289 kVideoFormat, |
| 274 kCodedSize, kVisibleRect, natural_size, | 290 kCodedSize, |
| 275 NULL, 0, false); | 291 kVisibleRect, |
| 292 natural_size, |
| 293 NULL, |
| 294 0, |
| 295 false); |
| 276 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 296 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 277 } | 297 } |
| 278 | 298 |
| 279 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorTooLarge) { | 299 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioNumeratorTooLarge) { |
| 280 int width = kVisibleRect.size().width(); | 300 int width = kVisibleRect.size().width(); |
| 281 int num = ceil(static_cast<double>(limits::kMaxDimension + 1) / width); | 301 int num = ceil(static_cast<double>(limits::kMaxDimension + 1) / width); |
| 282 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), num, 1); | 302 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), num, 1); |
| 283 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 303 VideoDecoderConfig config(kCodecVP8, |
| 304 VP8PROFILE_ANY, |
| 284 kVideoFormat, | 305 kVideoFormat, |
| 285 kCodedSize, kVisibleRect, natural_size, | 306 kCodedSize, |
| 286 NULL, 0, false); | 307 kVisibleRect, |
| 308 natural_size, |
| 309 NULL, |
| 310 0, |
| 311 false); |
| 287 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 312 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 288 } | 313 } |
| 289 | 314 |
| 290 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorTooLarge) { | 315 TEST_F(FFmpegVideoDecoderTest, Initialize_AspectRatioDenominatorTooLarge) { |
| 291 int den = kVisibleRect.size().width() + 1; | 316 int den = kVisibleRect.size().width() + 1; |
| 292 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, den); | 317 gfx::Size natural_size = GetNaturalSize(kVisibleRect.size(), 1, den); |
| 293 VideoDecoderConfig config(kCodecVP8, VP8PROFILE_MAIN, | 318 VideoDecoderConfig config(kCodecVP8, |
| 319 VP8PROFILE_ANY, |
| 294 kVideoFormat, | 320 kVideoFormat, |
| 295 kCodedSize, kVisibleRect, natural_size, | 321 kCodedSize, |
| 296 NULL, 0, false); | 322 kVisibleRect, |
| 323 natural_size, |
| 324 NULL, |
| 325 0, |
| 326 false); |
| 297 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); | 327 InitializeWithConfigAndStatus(config, DECODER_ERROR_NOT_SUPPORTED); |
| 298 } | 328 } |
| 299 | 329 |
| 300 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Normal) { | 330 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Normal) { |
| 301 Initialize(); | 331 Initialize(); |
| 302 Reinitialize(); | 332 Reinitialize(); |
| 303 } | 333 } |
| 304 | 334 |
| 305 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Failure) { | 335 TEST_F(FFmpegVideoDecoderTest, Reinitialize_Failure) { |
| 306 Initialize(); | 336 Initialize(); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 466 |
| 437 // Test destruction when decoder has hit end of stream. | 467 // Test destruction when decoder has hit end of stream. |
| 438 TEST_F(FFmpegVideoDecoderTest, Destroy_EndOfStream) { | 468 TEST_F(FFmpegVideoDecoderTest, Destroy_EndOfStream) { |
| 439 Initialize(); | 469 Initialize(); |
| 440 EnterDecodingState(); | 470 EnterDecodingState(); |
| 441 EnterEndOfStreamState(); | 471 EnterEndOfStreamState(); |
| 442 Destroy(); | 472 Destroy(); |
| 443 } | 473 } |
| 444 | 474 |
| 445 } // namespace media | 475 } // namespace media |
| OLD | NEW |