Index: media/filters/audio_decoder_unittest_ffmpeg.cc |
diff --git a/media/filters/audio_decoder_unittest_ffmpeg.cc b/media/filters/audio_decoder_unittest_ffmpeg.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b0493f64ffcf108f7c4172b549710100a51342f1 |
--- /dev/null |
+++ b/media/filters/audio_decoder_unittest_ffmpeg.cc |
@@ -0,0 +1,95 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "media/filters/audio_decoder_test.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace media { |
+ |
+#if defined(USE_PROPRIETARY_CODECS) |
+const DecodedBufferExpectations kSfxMp3Expectations[] = { |
+ {0, 1065, "2.81,3.99,4.53,4.10,3.08,2.46,"}, |
+ {1065, 26122, "-3.81,-4.14,-3.90,-3.36,-3.03,-3.23,"}, |
+ {27188, 26122, "4.24,3.95,4.22,4.78,5.13,4.93,"}, |
+}; |
+#endif |
+ |
+const DecodedBufferExpectations kSfxAdtsExpectations[] = { |
+ {0, 23219, "-1.90,-1.53,-0.15,1.28,1.23,-0.33,"}, |
+ {23219, 23219, "0.54,0.88,2.19,3.54,3.24,1.63,"}, |
+ {46439, 23219, "1.42,1.69,2.95,4.23,4.02,2.36,"}, |
+}; |
+ |
+#if defined(OS_CHROMEOS) |
+const DecodedBufferExpectations kSfxFlacExpectations[] = { |
+ {0, 104489, "-2.42,-1.12,0.71,1.70,1.09,-0.68,"}, |
+ {104489, 104489, "-1.99,-0.67,1.18,2.19,1.60,-0.16,"}, |
+ {208979, 79433, "2.84,2.70,3.23,4.06,4.59,4.44,"}, |
+}; |
+#endif |
+ |
+const DecodedBufferExpectations kSfxWaveExpectations[] = { |
+ {0, 23219, "-1.23,-0.87,0.47,1.85,1.88,0.29,"}, |
+ {23219, 23219, "0.75,1.10,2.43,3.78,3.53,1.93,"}, |
+ {46439, 23219, "1.27,1.56,2.83,4.13,3.87,2.23,"}, |
+}; |
+ |
+const DecodedBufferExpectations kFourChannelWaveExpectations[] = { |
+ {0, 11609, "-1.68,1.68,0.89,-3.45,1.52,1.15,"}, |
+ {11609, 11609, "43.26,9.06,18.27,35.98,19.45,7.46,"}, |
+ {23219, 11609, "36.37,9.45,16.04,27.67,18.81,10.15,"}, |
+}; |
+ |
+const DecodedBufferExpectations kSfxOggExpectations[] = { |
+ {0, 13061, "-0.33,1.25,2.86,3.26,2.09,0.14,"}, |
+ {13061, 23219, "-2.79,-2.42,-1.06,0.33,0.93,-0.64,"}, |
+ {36281, 23219, "-1.19,-0.80,0.57,1.97,2.08,0.51,"}, |
+}; |
+ |
+const DecodedBufferExpectations kBearOgvExpectations[] = { |
+ {0, 13061, "-1.25,0.10,2.11,2.29,1.50,-0.68,"}, |
+ {13061, 23219, "-1.80,-1.41,-0.13,1.30,1.65,0.01,"}, |
+ {36281, 23219, "-1.43,-1.25,0.11,1.29,1.86,0.14,"}, |
+}; |
+ |
+const DecoderTestData kFFmpegTests[] = { |
+ {FFMPEG, kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+#if defined(USE_PROPRIETARY_CODECS) |
+ {FFMPEG, kCodecMP3, "sfx.mp3", kSfxMp3Expectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+ {FFMPEG, kCodecAAC, "sfx.adts", kSfxAdtsExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+#endif |
+#if defined(OS_CHROMEOS) |
+ {FFMPEG, kCodecFLAC, "sfx.flac", kSfxFlacExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+#endif |
+ {FFMPEG, kCodecPCM, "sfx_f32le.wav", kSfxWaveExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+ {FFMPEG, kCodecPCM, "4ch.wav", kFourChannelWaveExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_QUAD}, |
+ {FFMPEG, kCodecVorbis, "sfx.ogg", kSfxOggExpectations, 0, 44100, |
+ CHANNEL_LAYOUT_MONO}, |
+ // Note: bear.ogv is incorrectly muxed such that valid samples are given |
+ // negative timestamps, this marks them for discard per the ogg vorbis spec. |
+ {FFMPEG, kCodecVorbis, "bear.ogv", kBearOgvExpectations, -704, 44100, |
+ CHANNEL_LAYOUT_STEREO}, |
+}; |
+ |
+// Dummy data for FFmpeg behavioral test. |
+const DecoderTestData kFFmpegBehavioralTest[] = { |
+ {FFMPEG, kUnknownAudioCodec, "", NULL, 0, 0, CHANNEL_LAYOUT_NONE}, |
+}; |
+ |
+class FFmpegAudioDecoderBehavioralTest : public AudioDecoderTest {}; |
+ |
+INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderTest, |
+ AudioDecoderTest, |
+ testing::ValuesIn(kFFmpegTests)); |
+INSTANTIATE_TEST_CASE_P(FFmpegAudioDecoderBehavioralTest, |
+ FFmpegAudioDecoderBehavioralTest, |
+ testing::ValuesIn(kFFmpegBehavioralTest)); |
+ |
+} // namespace media |