Index: media/base/sinc_resampler_unittest.cc |
diff --git a/media/base/sinc_resampler_unittest.cc b/media/base/sinc_resampler_unittest.cc |
index b7aaec43c2c2d6729f24d8d385f6a88570ed1c88..1b2c338bc38312859df65a01d0fb0914dfc829ca 100644 |
--- a/media/base/sinc_resampler_unittest.cc |
+++ b/media/base/sinc_resampler_unittest.cc |
@@ -98,6 +98,24 @@ TEST(SincResamplerTest, Flush) { |
ASSERT_FLOAT_EQ(resampled_destination[i], 0); |
} |
+// Test flush resets the internal state properly. |
+TEST(SincResamplerTest, KernelBench) { |
+ MockSource mock_source; |
+ SincResampler resampler( |
+ kSampleRateRatio, |
+ base::Bind(&MockSource::ProvideInput, base::Unretained(&mock_source))); |
+ scoped_array<float> resampled_destination(new float[resampler.ChunkSize()]); |
+ |
+ base::TimeTicks start = base::TimeTicks::HighResNow(); |
+ for (int i = 1; i < 10000; ++i) { |
+ resampler.UpdateSampleRateRatio((i % 100) / 100.0); |
+ } |
+ double total_time_c_ms = |
+ (base::TimeTicks::HighResNow() - start).InMillisecondsF(); |
+ printf("UpdateSampleRateRatio took %.2fms.\n", total_time_c_ms); |
+} |
+ |
+ |
// Define platform independent function name for Convolve* tests. |
#if defined(ARCH_CPU_X86_FAMILY) |
#define CONVOLVE_FUNC Convolve_SSE |