OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // The format of these tests are to enqueue a known amount of data and then | 5 // The format of these tests are to enqueue a known amount of data and then |
6 // request the exact amount we expect in order to dequeue the known amount of | 6 // request the exact amount we expect in order to dequeue the known amount of |
7 // data. This ensures that for any rate we are consuming input data at the | 7 // data. This ensures that for any rate we are consuming input data at the |
8 // correct rate. We always pass in a very large destination buffer with the | 8 // correct rate. We always pass in a very large destination buffer with the |
9 // expectation that FillBuffer() will fill as much as it can but no more. | 9 // expectation that FillBuffer() will fill as much as it can but no more. |
10 | 10 |
11 #include <algorithm> // For std::min(). | 11 #include <algorithm> // For std::min(). |
12 #include <cmath> | 12 #include <cmath> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/callback.h" | 16 #include "base/callback.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "media/base/audio_buffer.h" | 18 #include "media/base/audio_buffer.h" |
19 #include "media/base/audio_bus.h" | 19 #include "media/base/audio_bus.h" |
20 #include "media/base/buffers.h" | 20 #include "media/base/buffers.h" |
21 #include "media/base/channel_layout.h" | 21 #include "media/base/channel_layout.h" |
22 #include "media/base/test_helpers.h" | 22 #include "media/base/test_helpers.h" |
23 #include "media/filters/audio_renderer_algorithm.h" | |
24 #include "media/filters/wsola_internals.h" | 23 #include "media/filters/wsola_internals.h" |
| 24 #include "media/renderers/audio_renderer_algorithm.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 namespace media { | 27 namespace media { |
28 | 28 |
29 const int kFrameSize = 250; | 29 const int kFrameSize = 250; |
30 const int kSamplesPerSecond = 3000; | 30 const int kSamplesPerSecond = 3000; |
31 const int kOutputDurationInSec = 10; | 31 const int kOutputDurationInSec = 10; |
32 | 32 |
33 static void FillWithSquarePulseTrain( | 33 static void FillWithSquarePulseTrain( |
34 int half_pulse_width, int offset, int num_samples, float* data) { | 34 int half_pulse_width, int offset, int num_samples, float* data) { |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 | 676 |
677 const int frames_filled = | 677 const int frames_filled = |
678 algorithm_.FillBuffer(bus.get(), kHalfSize, kHalfSize, kMutedRates[i]); | 678 algorithm_.FillBuffer(bus.get(), kHalfSize, kHalfSize, kMutedRates[i]); |
679 ASSERT_EQ(kHalfSize, frames_filled); | 679 ASSERT_EQ(kHalfSize, frames_filled); |
680 ASSERT_FALSE(VerifyAudioData(bus.get(), 0, kHalfSize, 0)); | 680 ASSERT_FALSE(VerifyAudioData(bus.get(), 0, kHalfSize, 0)); |
681 ASSERT_TRUE(VerifyAudioData(bus.get(), kHalfSize, kHalfSize, 0)); | 681 ASSERT_TRUE(VerifyAudioData(bus.get(), kHalfSize, kHalfSize, 0)); |
682 } | 682 } |
683 } | 683 } |
684 | 684 |
685 } // namespace media | 685 } // namespace media |
OLD | NEW |