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 <deque> | 5 #include <deque> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/md5.h" | 10 #include "base/md5.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 DecodeBuffer(buffer); | 373 DecodeBuffer(buffer); |
374 EXPECT_EQ(AudioDecoder::kDecodeError, last_decode_status()); | 374 EXPECT_EQ(AudioDecoder::kDecodeError, last_decode_status()); |
375 } | 375 } |
376 | 376 |
377 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithNoCodecDelay) { | 377 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithNoCodecDelay) { |
378 ASSERT_EQ(GetParam().decoder_type, OPUS); | 378 ASSERT_EQ(GetParam().decoder_type, OPUS); |
379 std::vector<uint8_t> extra_data( | 379 std::vector<uint8_t> extra_data( |
380 kOpusExtraData, | 380 kOpusExtraData, |
381 kOpusExtraData + arraysize(kOpusExtraData)); | 381 kOpusExtraData + arraysize(kOpusExtraData)); |
382 AudioDecoderConfig decoder_config; | 382 AudioDecoderConfig decoder_config; |
383 decoder_config.Initialize(kCodecOpus, | 383 decoder_config.Initialize(kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, |
384 kSampleFormatF32, | 384 48000, extra_data, EncryptionScheme(false), |
385 CHANNEL_LAYOUT_STEREO, | 385 base::TimeDelta::FromMilliseconds(80), 0); |
386 48000, | |
387 extra_data, | |
388 false, | |
389 base::TimeDelta::FromMilliseconds(80), | |
390 0); | |
391 InitializeDecoder(decoder_config); | 386 InitializeDecoder(decoder_config); |
392 } | 387 } |
393 | 388 |
394 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithBadCodecDelay) { | 389 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithBadCodecDelay) { |
395 ASSERT_EQ(GetParam().decoder_type, OPUS); | 390 ASSERT_EQ(GetParam().decoder_type, OPUS); |
396 std::vector<uint8_t> extra_data( | 391 std::vector<uint8_t> extra_data( |
397 kOpusExtraData, | 392 kOpusExtraData, |
398 kOpusExtraData + arraysize(kOpusExtraData)); | 393 kOpusExtraData + arraysize(kOpusExtraData)); |
399 AudioDecoderConfig decoder_config; | 394 AudioDecoderConfig decoder_config; |
400 decoder_config.Initialize( | 395 decoder_config.Initialize( |
401 kCodecOpus, | 396 kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 48000, extra_data, |
402 kSampleFormatF32, | 397 EncryptionScheme(false), base::TimeDelta::FromMilliseconds(80), |
403 CHANNEL_LAYOUT_STEREO, | |
404 48000, | |
405 extra_data, | |
406 false, | |
407 base::TimeDelta::FromMilliseconds(80), | |
408 // Use a different codec delay than in the extradata. | 398 // Use a different codec delay than in the extradata. |
409 100); | 399 100); |
410 InitializeDecoderWithResult(decoder_config, true); | 400 InitializeDecoderWithResult(decoder_config, true); |
411 } | 401 } |
412 | 402 |
413 #if defined(OPUS_FIXED_POINT) | 403 #if defined(OPUS_FIXED_POINT) |
414 const DecodedBufferExpectations kSfxOpusExpectations[] = { | 404 const DecodedBufferExpectations kSfxOpusExpectations[] = { |
415 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, | 405 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, |
416 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"}, | 406 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"}, |
417 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"}, | 407 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"}, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 }; | 514 }; |
525 | 515 |
526 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, | 516 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, |
527 AudioDecoderTest, | 517 AudioDecoderTest, |
528 testing::ValuesIn(kFFmpegTests)); | 518 testing::ValuesIn(kFFmpegTests)); |
529 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, | 519 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, |
530 FFmpegAudioDecoderBehavioralTest, | 520 FFmpegAudioDecoderBehavioralTest, |
531 testing::ValuesIn(kFFmpegBehavioralTest)); | 521 testing::ValuesIn(kFFmpegBehavioralTest)); |
532 | 522 |
533 } // namespace media | 523 } // namespace media |
OLD | NEW |