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