Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: media/filters/audio_decoder_unittest.cc

Issue 1727953005: Enable AudioDecoder unit tests on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed contitions from base/container_names.* compilation Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/audio_hash.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 EXPECT_EQ(sample_info.duration, buffer->duration().InMicroseconds()); 270 EXPECT_EQ(sample_info.duration, buffer->duration().InMicroseconds());
271 EXPECT_FALSE(buffer->end_of_stream()); 271 EXPECT_FALSE(buffer->end_of_stream());
272 272
273 scoped_ptr<AudioBus> output = 273 scoped_ptr<AudioBus> output =
274 AudioBus::Create(buffer->channel_count(), buffer->frame_count()); 274 AudioBus::Create(buffer->channel_count(), buffer->frame_count());
275 buffer->ReadFrames(buffer->frame_count(), 0, 0, output.get()); 275 buffer->ReadFrames(buffer->frame_count(), 0, 0, output.get());
276 276
277 // Generate a lossy hash of the audio used for comparison across platforms. 277 // Generate a lossy hash of the audio used for comparison across platforms.
278 AudioHash audio_hash; 278 AudioHash audio_hash;
279 audio_hash.Update(output.get(), output->frames()); 279 audio_hash.Update(output.get(), output->frames());
280 EXPECT_EQ(sample_info.hash, audio_hash.ToString()); 280 EXPECT_TRUE(audio_hash.IsEquivalent(sample_info.hash, 0.02))
281 << "Audio hashes differ. Expected: " << sample_info.hash
282 << " Actual: " << audio_hash.ToString();
281 283
282 if (!exact_hash.empty()) { 284 if (!exact_hash.empty()) {
283 EXPECT_EQ(exact_hash, GetDecodedAudioMD5(i)); 285 EXPECT_EQ(exact_hash, GetDecodedAudioMD5(i));
284 286
285 // Verify different hashes are being generated. None of our test data 287 // Verify different hashes are being generated. None of our test data
286 // files have audio that hashes out exactly the same. 288 // files have audio that hashes out exactly the same.
287 if (i > 0) 289 if (i > 0)
288 EXPECT_NE(exact_hash, GetDecodedAudioMD5(i - 1)); 290 EXPECT_NE(exact_hash, GetDecodedAudioMD5(i - 1));
289 } 291 }
290 } 292 }
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 {OPUS, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, 448 {OPUS, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE},
447 }; 449 };
448 450
449 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderTest, 451 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderTest,
450 AudioDecoderTest, 452 AudioDecoderTest,
451 testing::ValuesIn(kOpusTests)); 453 testing::ValuesIn(kOpusTests));
452 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderBehavioralTest, 454 INSTANTIATE_TEST_CASE_P(OpusAudioDecoderBehavioralTest,
453 OpusAudioDecoderBehavioralTest, 455 OpusAudioDecoderBehavioralTest,
454 testing::ValuesIn(kOpusBehavioralTest)); 456 testing::ValuesIn(kOpusBehavioralTest));
455 457
458 // Disable all FFmpeg decoder tests on Android. http://crbug.com/570762.
459 #if !defined(OS_ANDROID)
460
456 #if defined(USE_PROPRIETARY_CODECS) 461 #if defined(USE_PROPRIETARY_CODECS)
457 const DecodedBufferExpectations kSfxMp3Expectations[] = { 462 const DecodedBufferExpectations kSfxMp3Expectations[] = {
458 {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"}, 463 {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"},
459 {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"}, 464 {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"},
460 {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"}, 465 {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"},
461 }; 466 };
462 467
463 const DecodedBufferExpectations kSfxAdtsExpectations[] = { 468 const DecodedBufferExpectations kSfxAdtsExpectations[] = {
464 {0, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"}, 469 {0, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"},
465 {23219, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"}, 470 {23219, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"},
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, 532 {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE},
528 }; 533 };
529 534
530 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, 535 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest,
531 AudioDecoderTest, 536 AudioDecoderTest,
532 testing::ValuesIn(kFFmpegTests)); 537 testing::ValuesIn(kFFmpegTests));
533 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, 538 INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest,
534 FFmpegAudioDecoderBehavioralTest, 539 FFmpegAudioDecoderBehavioralTest,
535 testing::ValuesIn(kFFmpegBehavioralTest)); 540 testing::ValuesIn(kFFmpegBehavioralTest));
536 541
542 #endif // !defined(OS_ANDROID)
543
537 } // namespace media 544 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_hash.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698