| 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 11 matching lines...) Expand all Loading... |
| 22 #include "media/base/audio_hash.h" | 22 #include "media/base/audio_hash.h" |
| 23 #include "media/base/decoder_buffer.h" | 23 #include "media/base/decoder_buffer.h" |
| 24 #include "media/base/media_util.h" | 24 #include "media/base/media_util.h" |
| 25 #include "media/base/test_data_util.h" | 25 #include "media/base/test_data_util.h" |
| 26 #include "media/base/test_helpers.h" | 26 #include "media/base/test_helpers.h" |
| 27 #include "media/base/timestamp_constants.h" | 27 #include "media/base/timestamp_constants.h" |
| 28 #include "media/ffmpeg/ffmpeg_common.h" | 28 #include "media/ffmpeg/ffmpeg_common.h" |
| 29 #include "media/filters/audio_file_reader.h" | 29 #include "media/filters/audio_file_reader.h" |
| 30 #include "media/filters/ffmpeg_audio_decoder.h" | 30 #include "media/filters/ffmpeg_audio_decoder.h" |
| 31 #include "media/filters/in_memory_url_protocol.h" | 31 #include "media/filters/in_memory_url_protocol.h" |
| 32 #include "media/filters/opus_audio_decoder.h" | |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 33 |
| 35 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
| 36 #include "base/android/build_info.h" | 35 #include "base/android/build_info.h" |
| 37 #include "media/base/android/media_codec_util.h" | 36 #include "media/base/android/media_codec_util.h" |
| 38 #include "media/filters/android/media_codec_audio_decoder.h" | 37 #include "media/filters/android/media_codec_audio_decoder.h" |
| 39 | 38 |
| 40 #if defined(USE_PROPRIETARY_CODECS) | 39 #if defined(USE_PROPRIETARY_CODECS) |
| 41 #include "media/formats/mpeg/adts_stream_parser.h" | 40 #include "media/formats/mpeg/adts_stream_parser.h" |
| 42 #endif | 41 #endif |
| (...skipping 16 matching lines...) Expand all Loading... |
| 59 #else | 58 #else |
| 60 #define SKIP_TEST_IF_NO_MEDIA_CODEC() \ | 59 #define SKIP_TEST_IF_NO_MEDIA_CODEC() \ |
| 61 do { \ | 60 do { \ |
| 62 } while (0) | 61 } while (0) |
| 63 #endif // !defined(OS_ANDROID) | 62 #endif // !defined(OS_ANDROID) |
| 64 | 63 |
| 65 namespace media { | 64 namespace media { |
| 66 | 65 |
| 67 // The number of packets to read and then decode from each file. | 66 // The number of packets to read and then decode from each file. |
| 68 static const size_t kDecodeRuns = 3; | 67 static const size_t kDecodeRuns = 3; |
| 69 static const uint8_t kOpusExtraData[] = { | |
| 70 0x4f, 0x70, 0x75, 0x73, 0x48, 0x65, 0x61, 0x64, 0x01, 0x02, | |
| 71 // The next two bytes represent the codec delay. | |
| 72 0x00, 0x00, 0x80, 0xbb, 0x00, 0x00, 0x00, 0x00, 0x00}; | |
| 73 | 68 |
| 74 enum AudioDecoderType { | 69 enum AudioDecoderType { |
| 75 FFMPEG, | 70 FFMPEG, |
| 76 OPUS, | |
| 77 #if defined(OS_ANDROID) | 71 #if defined(OS_ANDROID) |
| 78 MEDIA_CODEC, | 72 MEDIA_CODEC, |
| 79 #endif | 73 #endif |
| 80 }; | 74 }; |
| 81 | 75 |
| 82 struct DecodedBufferExpectations { | 76 struct DecodedBufferExpectations { |
| 83 const int64_t timestamp; | 77 const int64_t timestamp; |
| 84 const int64_t duration; | 78 const int64_t duration; |
| 85 const char* hash; | 79 const char* hash; |
| 86 }; | 80 }; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 public: | 129 public: |
| 136 AudioDecoderTest() | 130 AudioDecoderTest() |
| 137 : pending_decode_(false), | 131 : pending_decode_(false), |
| 138 pending_reset_(false), | 132 pending_reset_(false), |
| 139 last_decode_status_(DecodeStatus::DECODE_ERROR) { | 133 last_decode_status_(DecodeStatus::DECODE_ERROR) { |
| 140 switch (GetParam().decoder_type) { | 134 switch (GetParam().decoder_type) { |
| 141 case FFMPEG: | 135 case FFMPEG: |
| 142 decoder_.reset(new FFmpegAudioDecoder(message_loop_.task_runner(), | 136 decoder_.reset(new FFmpegAudioDecoder(message_loop_.task_runner(), |
| 143 new MediaLog())); | 137 new MediaLog())); |
| 144 break; | 138 break; |
| 145 case OPUS: | |
| 146 decoder_.reset( | |
| 147 new OpusAudioDecoder(message_loop_.task_runner())); | |
| 148 break; | |
| 149 #if defined(OS_ANDROID) | 139 #if defined(OS_ANDROID) |
| 150 case MEDIA_CODEC: | 140 case MEDIA_CODEC: |
| 151 decoder_.reset(new MediaCodecAudioDecoder(message_loop_.task_runner())); | 141 decoder_.reset(new MediaCodecAudioDecoder(message_loop_.task_runner())); |
| 152 break; | 142 break; |
| 153 #endif | 143 #endif |
| 154 } | 144 } |
| 155 } | 145 } |
| 156 | 146 |
| 157 virtual ~AudioDecoderTest() { | 147 virtual ~AudioDecoderTest() { |
| 158 EXPECT_FALSE(pending_decode_); | 148 EXPECT_FALSE(pending_decode_); |
| 159 EXPECT_FALSE(pending_reset_); | 149 EXPECT_FALSE(pending_reset_); |
| 160 } | 150 } |
| 161 | 151 |
| 162 protected: | 152 protected: |
| 163 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer) { | 153 void DecodeBuffer(const scoped_refptr<DecoderBuffer>& buffer) { |
| 164 ASSERT_FALSE(pending_decode_); | 154 ASSERT_FALSE(pending_decode_); |
| 165 pending_decode_ = true; | 155 pending_decode_ = true; |
| 166 last_decode_status_ = DecodeStatus::DECODE_ERROR; | 156 last_decode_status_ = DecodeStatus::DECODE_ERROR; |
| 167 | 157 |
| 168 base::RunLoop run_loop; | 158 base::RunLoop run_loop; |
| 169 decoder_->Decode( | 159 decoder_->Decode( |
| 170 buffer, base::Bind(&AudioDecoderTest::DecodeFinished, | 160 buffer, base::Bind(&AudioDecoderTest::DecodeFinished, |
| 171 base::Unretained(this), run_loop.QuitClosure())); | 161 base::Unretained(this), run_loop.QuitClosure())); |
| 172 run_loop.Run(); | 162 run_loop.Run(); |
| 173 ASSERT_FALSE(pending_decode_); | 163 ASSERT_FALSE(pending_decode_); |
| 174 } | 164 } |
| 175 | 165 |
| 176 void SendEndOfStream() { | 166 void SendEndOfStream() { DecodeBuffer(DecoderBuffer::CreateEOSBuffer()); } |
| 177 DecodeBuffer(DecoderBuffer::CreateEOSBuffer()); | |
| 178 } | |
| 179 | 167 |
| 180 void Initialize() { | 168 void Initialize() { |
| 181 // Load the test data file. | 169 // Load the test data file. |
| 182 data_ = ReadTestDataFile(GetParam().filename); | 170 data_ = ReadTestDataFile(GetParam().filename); |
| 183 protocol_.reset( | 171 protocol_.reset( |
| 184 new InMemoryUrlProtocol(data_->data(), data_->data_size(), false)); | 172 new InMemoryUrlProtocol(data_->data(), data_->data_size(), false)); |
| 185 reader_.reset(new AudioFileReader(protocol_.get())); | 173 reader_.reset(new AudioFileReader(protocol_.get())); |
| 186 ASSERT_TRUE(reader_->OpenDemuxerForTesting()); | 174 ASSERT_TRUE(reader_->OpenDemuxerForTesting()); |
| 187 | 175 |
| 188 // Load the first packet and check its timestamp. | 176 // Load the first packet and check its timestamp. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 DecoderBuffer::CopyFrom(packet.data, packet.size); | 238 DecoderBuffer::CopyFrom(packet.data, packet.size); |
| 251 buffer->set_timestamp(ConvertFromTimeBase( | 239 buffer->set_timestamp(ConvertFromTimeBase( |
| 252 reader_->GetAVStreamForTesting()->time_base, packet.pts)); | 240 reader_->GetAVStreamForTesting()->time_base, packet.pts)); |
| 253 buffer->set_duration(ConvertFromTimeBase( | 241 buffer->set_duration(ConvertFromTimeBase( |
| 254 reader_->GetAVStreamForTesting()->time_base, packet.duration)); | 242 reader_->GetAVStreamForTesting()->time_base, packet.duration)); |
| 255 if (packet.flags & AV_PKT_FLAG_KEY) | 243 if (packet.flags & AV_PKT_FLAG_KEY) |
| 256 buffer->set_is_key_frame(true); | 244 buffer->set_is_key_frame(true); |
| 257 | 245 |
| 258 // Don't set discard padding for Opus, it already has discard behavior set | 246 // Don't set discard padding for Opus, it already has discard behavior set |
| 259 // based on the codec delay in the AudioDecoderConfig. | 247 // based on the codec delay in the AudioDecoderConfig. |
| 260 if (GetParam().decoder_type == FFMPEG) | 248 if (GetParam().decoder_type == FFMPEG && GetParam().codec != kCodecOpus) |
| 261 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second); | 249 SetDiscardPadding(&packet, buffer, GetParam().samples_per_second); |
| 262 | 250 |
| 263 // DecodeBuffer() shouldn't need the original packet since it uses the copy. | 251 // DecodeBuffer() shouldn't need the original packet since it uses the copy. |
| 264 av_packet_unref(&packet); | 252 av_packet_unref(&packet); |
| 265 DecodeBuffer(buffer); | 253 DecodeBuffer(buffer); |
| 266 } | 254 } |
| 267 | 255 |
| 268 void Reset() { | 256 void Reset() { |
| 269 ASSERT_FALSE(pending_reset_); | 257 ASSERT_FALSE(pending_reset_); |
| 270 pending_reset_ = true; | 258 pending_reset_ = true; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 bool pending_decode_; | 373 bool pending_decode_; |
| 386 bool pending_reset_; | 374 bool pending_reset_; |
| 387 DecodeStatus last_decode_status_; | 375 DecodeStatus last_decode_status_; |
| 388 | 376 |
| 389 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; | 377 std::deque<scoped_refptr<AudioBuffer> > decoded_audio_; |
| 390 base::TimeDelta start_timestamp_; | 378 base::TimeDelta start_timestamp_; |
| 391 | 379 |
| 392 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); | 380 DISALLOW_COPY_AND_ASSIGN(AudioDecoderTest); |
| 393 }; | 381 }; |
| 394 | 382 |
| 395 class OpusAudioDecoderBehavioralTest : public AudioDecoderTest {}; | |
| 396 class FFmpegAudioDecoderBehavioralTest : public AudioDecoderTest {}; | 383 class FFmpegAudioDecoderBehavioralTest : public AudioDecoderTest {}; |
| 397 | 384 |
| 398 TEST_P(AudioDecoderTest, Initialize) { | 385 TEST_P(AudioDecoderTest, Initialize) { |
| 399 SKIP_TEST_IF_NO_MEDIA_CODEC(); | 386 SKIP_TEST_IF_NO_MEDIA_CODEC(); |
| 400 ASSERT_NO_FATAL_FAILURE(Initialize()); | 387 ASSERT_NO_FATAL_FAILURE(Initialize()); |
| 401 } | 388 } |
| 402 | 389 |
| 403 // Verifies decode audio as well as the Decode() -> Reset() sequence. | 390 // Verifies decode audio as well as the Decode() -> Reset() sequence. |
| 404 TEST_P(AudioDecoderTest, ProduceAudioSamples) { | 391 TEST_P(AudioDecoderTest, ProduceAudioSamples) { |
| 405 SKIP_TEST_IF_NO_MEDIA_CODEC(); | 392 SKIP_TEST_IF_NO_MEDIA_CODEC(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 444 |
| 458 TEST_P(AudioDecoderTest, NoTimestamp) { | 445 TEST_P(AudioDecoderTest, NoTimestamp) { |
| 459 SKIP_TEST_IF_NO_MEDIA_CODEC(); | 446 SKIP_TEST_IF_NO_MEDIA_CODEC(); |
| 460 ASSERT_NO_FATAL_FAILURE(Initialize()); | 447 ASSERT_NO_FATAL_FAILURE(Initialize()); |
| 461 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); | 448 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(0)); |
| 462 buffer->set_timestamp(kNoTimestamp); | 449 buffer->set_timestamp(kNoTimestamp); |
| 463 DecodeBuffer(buffer); | 450 DecodeBuffer(buffer); |
| 464 EXPECT_EQ(DecodeStatus::DECODE_ERROR, last_decode_status()); | 451 EXPECT_EQ(DecodeStatus::DECODE_ERROR, last_decode_status()); |
| 465 } | 452 } |
| 466 | 453 |
| 467 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithNoCodecDelay) { | |
| 468 ASSERT_EQ(GetParam().decoder_type, OPUS); | |
| 469 std::vector<uint8_t> extra_data( | |
| 470 kOpusExtraData, | |
| 471 kOpusExtraData + arraysize(kOpusExtraData)); | |
| 472 AudioDecoderConfig decoder_config; | |
| 473 decoder_config.Initialize(kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, | |
| 474 48000, extra_data, Unencrypted(), | |
| 475 base::TimeDelta::FromMilliseconds(80), 0); | |
| 476 InitializeDecoder(decoder_config); | |
| 477 } | |
| 478 | |
| 479 TEST_P(OpusAudioDecoderBehavioralTest, InitializeWithBadCodecDelay) { | |
| 480 ASSERT_EQ(GetParam().decoder_type, OPUS); | |
| 481 std::vector<uint8_t> extra_data( | |
| 482 kOpusExtraData, | |
| 483 kOpusExtraData + arraysize(kOpusExtraData)); | |
| 484 AudioDecoderConfig decoder_config; | |
| 485 decoder_config.Initialize( | |
| 486 kCodecOpus, kSampleFormatF32, CHANNEL_LAYOUT_STEREO, 48000, extra_data, | |
| 487 Unencrypted(), base::TimeDelta::FromMilliseconds(80), | |
| 488 // Use a different codec delay than in the extradata. | |
| 489 100); | |
| 490 InitializeDecoderWithResult(decoder_config, true); | |
| 491 } | |
| 492 | |
| 493 #if defined(OPUS_FIXED_POINT) | |
| 494 const DecodedBufferExpectations kSfxOpusExpectations[] = { | |
| 495 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, | |
| 496 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"}, | |
| 497 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"}, | |
| 498 }; | |
| 499 #else | |
| 500 const DecodedBufferExpectations kSfxOpusExpectations[] = { | |
| 501 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, | |
| 502 {13500, 20000, "5.48,5.93,6.04,5.83,5.54,5.45,"}, | |
| 503 {33500, 20000, "-3.45,-3.35,-3.57,-4.12,-4.74,-5.14,"}, | |
| 504 }; | |
| 505 #endif | |
| 506 | |
| 507 const DecodedBufferExpectations kBearOpusExpectations[] = { | 454 const DecodedBufferExpectations kBearOpusExpectations[] = { |
| 508 {500, 3500, "-0.26,0.87,1.36,0.84,-0.30,-1.22,"}, | 455 {500, 3500, "-0.26,0.87,1.36,0.84,-0.30,-1.22,"}, |
| 509 {4000, 10000, "0.09,0.23,0.21,0.03,-0.17,-0.24,"}, | 456 {4000, 10000, "0.09,0.23,0.21,0.03,-0.17,-0.24,"}, |
| 510 {14000, 10000, "0.10,0.24,0.23,0.04,-0.14,-0.23,"}, | 457 {14000, 10000, "0.10,0.24,0.23,0.04,-0.14,-0.23,"}, |
| 511 }; | 458 }; |
| 512 | 459 |
| 513 const DecoderTestData kOpusTests[] = { | |
| 514 {OPUS, kCodecOpus, "sfx-opus.ogg", kSfxOpusExpectations, -312, 48000, | |
| 515 CHANNEL_LAYOUT_MONO}, | |
| 516 {OPUS, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, | |
| 517 CHANNEL_LAYOUT_STEREO}, | |
| 518 }; | |
| 519 | |
| 520 // Dummy data for behavioral tests. | |
| 521 const DecoderTestData kOpusBehavioralTest[] = { | |
| 522 {OPUS, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, | |
| 523 }; | |
| 524 | |
| 525 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderTest, | |
| 526 AudioDecoderTest, | |
| 527 testing::ValuesIn(kOpusTests)); | |
| 528 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderBehavioralTest, | |
| 529 OpusAudioDecoderBehavioralTest, | |
| 530 testing::ValuesIn(kOpusBehavioralTest)); | |
| 531 | |
| 532 #if defined(OS_ANDROID) | 460 #if defined(OS_ANDROID) |
| 533 #if defined(USE_PROPRIETARY_CODECS) | 461 #if defined(USE_PROPRIETARY_CODECS) |
| 534 const DecodedBufferExpectations kSfxAdtsMcExpectations[] = { | 462 const DecodedBufferExpectations kSfxAdtsMcExpectations[] = { |
| 535 {0, 23219, "-1.80,-1.49,-0.23,1.11,1.54,-0.11,"}, | 463 {0, 23219, "-1.80,-1.49,-0.23,1.11,1.54,-0.11,"}, |
| 536 {23219, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"}, | 464 {23219, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"}, |
| 537 {46439, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"}, | 465 {46439, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"}, |
| 538 }; | 466 }; |
| 539 | 467 |
| 540 const DecodedBufferExpectations kHeAacMcExpectations[] = { | 468 const DecodedBufferExpectations kHeAacMcExpectations[] = { |
| 541 {0, 42666, "-1.76,-0.12,1.72,1.45,0.10,-1.32,"}, | 469 {0, 42666, "-1.76,-0.12,1.72,1.45,0.10,-1.32,"}, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 {13061, 23219, "-2.79,-2.42,-1.06,0.33,0.93,-0.64,"}, | 527 {13061, 23219, "-2.79,-2.42,-1.06,0.33,0.93,-0.64,"}, |
| 600 {36281, 23219, "-1.19,-0.80,0.57,1.97,2.08,0.51,"}, | 528 {36281, 23219, "-1.19,-0.80,0.57,1.97,2.08,0.51,"}, |
| 601 }; | 529 }; |
| 602 | 530 |
| 603 const DecodedBufferExpectations kBearOgvExpectations[] = { | 531 const DecodedBufferExpectations kBearOgvExpectations[] = { |
| 604 {0, 13061, "-1.25,0.10,2.11,2.29,1.50,-0.68,"}, | 532 {0, 13061, "-1.25,0.10,2.11,2.29,1.50,-0.68,"}, |
| 605 {13061, 23219, "-1.80,-1.41,-0.13,1.30,1.65,0.01,"}, | 533 {13061, 23219, "-1.80,-1.41,-0.13,1.30,1.65,0.01,"}, |
| 606 {36281, 23219, "-1.43,-1.25,0.11,1.29,1.86,0.14,"}, | 534 {36281, 23219, "-1.43,-1.25,0.11,1.29,1.86,0.14,"}, |
| 607 }; | 535 }; |
| 608 | 536 |
| 537 #if defined(OPUS_FIXED_POINT) |
| 538 const DecodedBufferExpectations kSfxOpusExpectations[] = { |
| 539 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, |
| 540 {13500, 20000, "5.48,5.93,6.05,5.83,5.54,5.46,"}, |
| 541 {33500, 20000, "-3.44,-3.34,-3.57,-4.11,-4.74,-5.13,"}, |
| 542 }; |
| 543 #else |
| 544 const DecodedBufferExpectations kSfxOpusExpectations[] = { |
| 545 {0, 13500, "-2.70,-1.41,-0.78,-1.27,-2.56,-3.73,"}, |
| 546 {13500, 20000, "5.48,5.93,6.04,5.83,5.54,5.45,"}, |
| 547 {33500, 20000, "-3.45,-3.35,-3.57,-4.12,-4.74,-5.14,"}, |
| 548 }; |
| 549 #endif |
| 550 |
| 609 const DecoderTestData kFFmpegTests[] = { | 551 const DecoderTestData kFFmpegTests[] = { |
| 610 #if defined(USE_PROPRIETARY_CODECS) | 552 #if defined(USE_PROPRIETARY_CODECS) |
| 611 {FFMPEG, kCodecMP3, "sfx.mp3", kSfxMp3Expectations, 0, 44100, | 553 {FFMPEG, kCodecMP3, "sfx.mp3", kSfxMp3Expectations, 0, 44100, |
| 612 CHANNEL_LAYOUT_MONO}, | 554 CHANNEL_LAYOUT_MONO}, |
| 613 {FFMPEG, kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100, | 555 {FFMPEG, kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100, |
| 614 CHANNEL_LAYOUT_MONO}, | 556 CHANNEL_LAYOUT_MONO}, |
| 615 #endif | 557 #endif |
| 616 #if defined(OS_CHROMEOS) | 558 #if defined(OS_CHROMEOS) |
| 617 {FFMPEG, kCodecFLAC, "sfx.flac", kSfxFlacExpectations, 0, 44100, | 559 {FFMPEG, kCodecFLAC, "sfx.flac", kSfxFlacExpectations, 0, 44100, |
| 618 CHANNEL_LAYOUT_MONO}, | 560 CHANNEL_LAYOUT_MONO}, |
| 619 #endif | 561 #endif |
| 620 {FFMPEG, kCodecPCM, "sfx_f32le.wav", kSfxWaveExpectations, 0, 44100, | 562 {FFMPEG, kCodecPCM, "sfx_f32le.wav", kSfxWaveExpectations, 0, 44100, |
| 621 CHANNEL_LAYOUT_MONO}, | 563 CHANNEL_LAYOUT_MONO}, |
| 622 {FFMPEG, kCodecPCM, "4ch.wav", kFourChannelWaveExpectations, 0, 44100, | 564 {FFMPEG, kCodecPCM, "4ch.wav", kFourChannelWaveExpectations, 0, 44100, |
| 623 CHANNEL_LAYOUT_QUAD}, | 565 CHANNEL_LAYOUT_QUAD}, |
| 624 {FFMPEG, kCodecVorbis, "sfx.ogg", kSfxOggExpectations, 0, 44100, | 566 {FFMPEG, kCodecVorbis, "sfx.ogg", kSfxOggExpectations, 0, 44100, |
| 625 CHANNEL_LAYOUT_MONO}, | 567 CHANNEL_LAYOUT_MONO}, |
| 626 // Note: bear.ogv is incorrectly muxed such that valid samples are given | 568 // Note: bear.ogv is incorrectly muxed such that valid samples are given |
| 627 // negative timestamps, this marks them for discard per the ogg vorbis spec. | 569 // negative timestamps, this marks them for discard per the ogg vorbis spec. |
| 628 {FFMPEG, kCodecVorbis, "bear.ogv", kBearOgvExpectations, -704, 44100, | 570 {FFMPEG, kCodecVorbis, "bear.ogv", kBearOgvExpectations, -704, 44100, |
| 629 CHANNEL_LAYOUT_STEREO}, | 571 CHANNEL_LAYOUT_STEREO}, |
| 572 {FFMPEG, kCodecOpus, "sfx-opus.ogg", kSfxOpusExpectations, -312, 48000, |
| 573 CHANNEL_LAYOUT_MONO}, |
| 574 {FFMPEG, kCodecOpus, "bear-opus.ogg", kBearOpusExpectations, 24, 48000, |
| 575 CHANNEL_LAYOUT_STEREO}, |
| 630 }; | 576 }; |
| 631 | 577 |
| 632 // Dummy data for behavioral tests. | 578 // Dummy data for behavioral tests. |
| 633 const DecoderTestData kFFmpegBehavioralTest[] = { | 579 const DecoderTestData kFFmpegBehavioralTest[] = { |
| 634 {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, | 580 {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, |
| 635 }; | 581 }; |
| 636 | 582 |
| 637 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, | 583 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, |
| 638 AudioDecoderTest, | 584 AudioDecoderTest, |
| 639 testing::ValuesIn(kFFmpegTests)); | 585 testing::ValuesIn(kFFmpegTests)); |
| 640 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, | 586 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, |
| 641 FFmpegAudioDecoderBehavioralTest, | 587 FFmpegAudioDecoderBehavioralTest, |
| 642 testing::ValuesIn(kFFmpegBehavioralTest)); | 588 testing::ValuesIn(kFFmpegBehavioralTest)); |
| 643 | 589 |
| 644 } // namespace media | 590 } // namespace media |
| OLD | NEW |