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 |
11 #include <memory> | |
12 | |
13 #include "webrtc/common_audio/blocker.h" | 11 #include "webrtc/common_audio/blocker.h" |
14 | 12 |
15 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "webrtc/base/arraysize.h" | 14 #include "webrtc/base/arraysize.h" |
17 | 15 |
18 namespace { | 16 namespace { |
19 | 17 |
20 // Callback Function to add 3 to every sample in the signal. | 18 // Callback Function to add 3 to every sample in the signal. |
21 class PlusThreeBlockerCallback : public webrtc::BlockerCallback { | 19 class PlusThreeBlockerCallback : public webrtc::BlockerCallback { |
22 public: | 20 public: |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 300 } |
303 } | 301 } |
304 ChannelBuffer<float> input_cb(kNumFrames, kNumInputChannels); | 302 ChannelBuffer<float> input_cb(kNumFrames, kNumInputChannels); |
305 input_cb.SetDataForTesting(input[0], sizeof(input) / sizeof(**input)); | 303 input_cb.SetDataForTesting(input[0], sizeof(input) / sizeof(**input)); |
306 | 304 |
307 ChannelBuffer<float> output_cb(kNumFrames, kNumOutputChannels); | 305 ChannelBuffer<float> output_cb(kNumFrames, kNumOutputChannels); |
308 | 306 |
309 CopyBlockerCallback callback; | 307 CopyBlockerCallback callback; |
310 | 308 |
311 for (size_t i = 0; i < arraysize(kChunkSize); ++i) { | 309 for (size_t i = 0; i < arraysize(kChunkSize); ++i) { |
312 std::unique_ptr<float[]> window(new float[kBlockSize[i]]); | 310 rtc::scoped_ptr<float[]> window(new float[kBlockSize[i]]); |
313 for (size_t j = 0; j < kBlockSize[i]; ++j) { | 311 for (size_t j = 0; j < kBlockSize[i]; ++j) { |
314 window[j] = 1.f; | 312 window[j] = 1.f; |
315 } | 313 } |
316 | 314 |
317 ChannelBuffer<float> input_chunk_cb(kChunkSize[i], kNumInputChannels); | 315 ChannelBuffer<float> input_chunk_cb(kChunkSize[i], kNumInputChannels); |
318 ChannelBuffer<float> output_chunk_cb(kChunkSize[i], kNumOutputChannels); | 316 ChannelBuffer<float> output_chunk_cb(kChunkSize[i], kNumOutputChannels); |
319 | 317 |
320 Blocker blocker(kChunkSize[i], | 318 Blocker blocker(kChunkSize[i], |
321 kBlockSize[i], | 319 kBlockSize[i], |
322 kNumInputChannels, | 320 kNumInputChannels, |
(...skipping 13 matching lines...) Expand all Loading... |
336 kNumOutputChannels); | 334 kNumOutputChannels); |
337 | 335 |
338 ValidateInitialDelay(output_cb.channels(), | 336 ValidateInitialDelay(output_cb.channels(), |
339 kNumOutputChannels, | 337 kNumOutputChannels, |
340 kNumFrames, | 338 kNumFrames, |
341 kInitialDelay[i]); | 339 kInitialDelay[i]); |
342 } | 340 } |
343 } | 341 } |
344 | 342 |
345 } // namespace webrtc | 343 } // namespace webrtc |
OLD | NEW |