OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 bool pending_decode_; | 373 bool pending_decode_; |
374 bool pending_reset_; | 374 bool pending_reset_; |
375 DecodeStatus last_decode_status_; | 375 DecodeStatus last_decode_status_; |
376 | 376 |
377 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; | 377 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; |
378 base::TimeDelta start_timestamp_; | 378 base::TimeDelta start_timestamp_; |
379 | 379 |
380 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); | 380 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); |
381 }; | 381 }; |
382 | 382 |
383 class FFmpegAudioDecoderBehavioralTest : public AudioDecoderTest {}; | |
384 | |
385 TEST_P(AudioDecoderTest, Initialize) { | 383 TEST_P(AudioDecoderTest, Initialize) { |
386 SKIP_TEST_IF_NO_MEDIA_CODEC(); | 384 SKIP_TEST_IF_NO_MEDIA_CODEC(); |
387 ASSERT_NO_FATAL_FAILURE(Initialize()); | 385 ASSERT_NO_FATAL_FAILURE(Initialize()); |
388 } | 386 } |
389 | 387 |
390 // Verifies decode audio as well as the Decode() -> Reset() sequence. | 388 // Verifies decode audio as well as the Decode() -> Reset() sequence. |
391 TEST_P(AudioDecoderTest, ProduceAudioSamples) { | 389 TEST_P(AudioDecoderTest, ProduceAudioSamples) { |
392 SKIP_TEST_IF_NO_MEDIA_CODEC(); | 390 SKIP_TEST_IF_NO_MEDIA_CODEC(); |
393 ASSERT_NO_FATAL_FAILURE(Initialize()); | 391 ASSERT_NO_FATAL_FAILURE(Initialize()); |
394 | 392 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 {MEDIA_CODEC, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, | 474 {MEDIA_CODEC, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, |
477 CHANNEL_LAYOUT_STEREO}, | 475 CHANNEL_LAYOUT_STEREO}, |
478 #if defined(USE_PROPRIETARY_CODECS) | 476 #if defined(USE_PROPRIETARY_CODECS) |
479 {MEDIA_CODEC, kCodecAAC, "sfx.adts", kSfxAdtsMcExpectations, 0, 44100, | 477 {MEDIA_CODEC, kCodecAAC, "sfx.adts", kSfxAdtsMcExpectations, 0, 44100, |
480 CHANNEL_LAYOUT_MONO}, | 478 CHANNEL_LAYOUT_MONO}, |
481 {MEDIA_CODEC, kCodecAAC, "bear-audio-implicit-he-aac-v2.aac", | 479 {MEDIA_CODEC, kCodecAAC, "bear-audio-implicit-he-aac-v2.aac", |
482 kHeAacMcExpectations, 0, 24000, CHANNEL_LAYOUT_MONO}, | 480 kHeAacMcExpectations, 0, 24000, CHANNEL_LAYOUT_MONO}, |
483 #endif | 481 #endif |
484 }; | 482 }; |
485 | 483 |
486 INSTANTIATE_TEST_CASE_P(MediaCodecAudioDecoderTest, | 484 INSTANTIATE_TEST_CASE_P(MediaCodec, |
487 AudioDecoderTest, | 485 AudioDecoderTest, |
488 testing::ValuesIn(kMediaCodecTests)); | 486 testing::ValuesIn(kMediaCodecTests)); |
489 #endif // defined(OS_ANDROID) | 487 #endif // defined(OS_ANDROID) |
490 | 488 |
491 #if defined(USE_PROPRIETARY_CODECS) | 489 #if defined(USE_PROPRIETARY_CODECS) |
492 const DecodedBufferExpectations kSfxMp3Expectations[] = { | 490 const DecodedBufferExpectations kSfxMp3Expectations[] = { |
493 {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"}, | 491 {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"}, |
494 {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"}, | 492 {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"}, |
495 {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"}, | 493 {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"}, |
496 }; | 494 }; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // Note: bear.ogv is incorrectly muxed such that valid samples are given | 562 // Note: bear.ogv is incorrectly muxed such that valid samples are given |
565 // negative timestamps, this marks them for discard per the ogg vorbis spec. | 563 // negative timestamps, this marks them for discard per the ogg vorbis spec. |
566 {FFMPEG, kCodecVorbis, "bear.ogv", kBearOgvExpectations, -704, 44100, | 564 {FFMPEG, kCodecVorbis, "bear.ogv", kBearOgvExpectations, -704, 44100, |
567 CHANNEL_LAYOUT_STEREO}, | 565 CHANNEL_LAYOUT_STEREO}, |
568 {FFMPEG, kCodecOpus, "sfx-opus.ogg", kSfxOpusExpectations, -312, 48000, | 566 {FFMPEG, kCodecOpus, "sfx-opus.ogg", kSfxOpusExpectations, -312, 48000, |
569 CHANNEL_LAYOUT_MONO}, | 567 CHANNEL_LAYOUT_MONO}, |
570 {FFMPEG, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, | 568 {FFMPEG, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, |
571 CHANNEL_LAYOUT_STEREO}, | 569 CHANNEL_LAYOUT_STEREO}, |
572 }; | 570 }; |
573 | 571 |
574 // Dummy data for behavioral tests. | 572 INSTANTIATE_TEST_CASE_P(FFmpeg, |
575 const DecoderTestData kFFmpegBehavioralTest[] = { | |
576 {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, | |
577 }; | |
578 | |
579 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, | |
580 AudioDecoderTest, | 573 AudioDecoderTest, |
581 testing::ValuesIn(kFFmpegTests)); | 574 testing::ValuesIn(kFFmpegTests)); |
582 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, | |
583 FFmpegAudioDecoderBehavioralTest, | |
584 testing::ValuesIn(kFFmpegBehavioralTest)); | |
585 | 575 |
586 } // namespace media | 576 } // namespace media |
OLD | NEW |