OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 class FftCheckerCallback : public webrtc::LappedTransform::Callback { | 45 class FftCheckerCallback : public webrtc::LappedTransform::Callback { |
46 public: | 46 public: |
47 FftCheckerCallback() : block_num_(0) {} | 47 FftCheckerCallback() : block_num_(0) {} |
48 | 48 |
49 virtual void ProcessAudioBlock(const complex<float>* const* in_block, | 49 virtual void ProcessAudioBlock(const complex<float>* const* in_block, |
50 int in_channels, int frames, int out_channels, | 50 int in_channels, int frames, int out_channels, |
51 complex<float>* const* out_block) { | 51 complex<float>* const* out_block) { |
52 CHECK_EQ(in_channels, out_channels); | 52 CHECK_EQ(in_channels, out_channels); |
53 | 53 |
54 float full_length = (frames - 1) * 2; | 54 int full_length = (frames - 1) * 2; |
55 ++block_num_; | 55 ++block_num_; |
56 | 56 |
57 if (block_num_ > 0) { | 57 if (block_num_ > 0) { |
58 ASSERT_NEAR(in_block[0][0].real(), full_length, 1e-5f); | 58 ASSERT_NEAR(in_block[0][0].real(), static_cast<float>(full_length), |
| 59 1e-5f); |
59 ASSERT_NEAR(in_block[0][0].imag(), 0.0f, 1e-5f); | 60 ASSERT_NEAR(in_block[0][0].imag(), 0.0f, 1e-5f); |
60 for (int i = 1; i < frames; ++i) { | 61 for (int i = 1; i < frames; ++i) { |
61 ASSERT_NEAR(in_block[0][i].real(), 0.0f, 1e-5f); | 62 ASSERT_NEAR(in_block[0][i].real(), 0.0f, 1e-5f); |
62 ASSERT_NEAR(in_block[0][i].imag(), 0.0f, 1e-5f); | 63 ASSERT_NEAR(in_block[0][i].imag(), 0.0f, 1e-5f); |
63 } | 64 } |
64 } | 65 } |
65 } | 66 } |
66 | 67 |
67 int block_num() { | 68 int block_num() { |
68 return block_num_; | 69 return block_num_; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 { | 195 { |
195 const int kExpectedChunkLength = 160; | 196 const int kExpectedChunkLength = 160; |
196 const LappedTransform trans(1, 1, kExpectedChunkLength, window, | 197 const LappedTransform trans(1, 1, kExpectedChunkLength, window, |
197 kBlockLength, kBlockLength, &call); | 198 kBlockLength, kBlockLength, &call); |
198 | 199 |
199 EXPECT_EQ(kExpectedChunkLength, trans.chunk_length()); | 200 EXPECT_EQ(kExpectedChunkLength, trans.chunk_length()); |
200 } | 201 } |
201 } | 202 } |
202 | 203 |
203 } // namespace webrtc | 204 } // namespace webrtc |
OLD | NEW |