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