OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | 16 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
| 17 #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" |
| 18 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" |
17 #include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h" | 19 #include "webrtc/modules/audio_processing/aec3/render_delay_buffer.h" |
18 #include "webrtc/test/gmock.h" | 20 #include "webrtc/test/gmock.h" |
19 | 21 |
20 namespace webrtc { | 22 namespace webrtc { |
21 namespace test { | 23 namespace test { |
22 | 24 |
23 class MockRenderDelayBuffer : public RenderDelayBuffer { | 25 class MockRenderDelayBuffer : public RenderDelayBuffer { |
24 public: | 26 public: |
25 explicit MockRenderDelayBuffer(int sample_rate_hz) | 27 explicit MockRenderDelayBuffer(int sample_rate_hz) |
26 : block_(std::vector<std::vector<float>>( | 28 : render_buffer_(Aec3Optimization::kNone, |
27 NumBandsForRate(sample_rate_hz), | 29 NumBandsForRate(sample_rate_hz), |
28 std::vector<float>(kBlockSize, 0.f))) { | 30 kRenderDelayBufferSize, |
29 ON_CALL(*this, GetNext()) | 31 std::vector<size_t>(1, kAdaptiveFilterLength)) { |
| 32 ON_CALL(*this, GetRenderBuffer()) |
30 .WillByDefault( | 33 .WillByDefault( |
31 testing::Invoke(this, &MockRenderDelayBuffer::FakeGetNext)); | 34 testing::Invoke(this, &MockRenderDelayBuffer::FakeGetRenderBuffer)); |
| 35 ON_CALL(*this, GetDownsampledRenderBuffer()) |
| 36 .WillByDefault(testing::Invoke( |
| 37 this, &MockRenderDelayBuffer::FakeGetDownsampledRenderBuffer)); |
32 } | 38 } |
33 virtual ~MockRenderDelayBuffer() = default; | 39 virtual ~MockRenderDelayBuffer() = default; |
34 | 40 |
| 41 MOCK_METHOD0(Reset, void()); |
35 MOCK_METHOD1(Insert, bool(std::vector<std::vector<float>>* block)); | 42 MOCK_METHOD1(Insert, bool(std::vector<std::vector<float>>* block)); |
36 MOCK_METHOD0(GetNext, const std::vector<std::vector<float>>&()); | 43 MOCK_METHOD0(UpdateBuffers, bool()); |
37 MOCK_METHOD1(SetDelay, void(size_t delay)); | 44 MOCK_METHOD1(SetDelay, void(size_t delay)); |
38 MOCK_CONST_METHOD0(Delay, size_t()); | 45 MOCK_CONST_METHOD0(Delay, size_t()); |
39 MOCK_CONST_METHOD0(MaxDelay, size_t()); | 46 MOCK_CONST_METHOD0(MaxDelay, size_t()); |
40 MOCK_CONST_METHOD0(IsBlockAvailable, bool()); | 47 MOCK_CONST_METHOD0(IsBlockAvailable, bool()); |
41 MOCK_CONST_METHOD0(MaxApiJitter, size_t()); | 48 MOCK_CONST_METHOD0(GetRenderBuffer, const RenderBuffer&()); |
| 49 MOCK_CONST_METHOD0(GetDownsampledRenderBuffer, |
| 50 const DownsampledRenderBuffer&()); |
42 | 51 |
43 private: | 52 private: |
44 const std::vector<std::vector<float>>& FakeGetNext() const { return block_; } | 53 const RenderBuffer& FakeGetRenderBuffer() const { return render_buffer_; } |
45 std::vector<std::vector<float>> block_; | 54 const DownsampledRenderBuffer& FakeGetDownsampledRenderBuffer() const { |
| 55 return downsampled_render_buffer_; |
| 56 } |
| 57 RenderBuffer render_buffer_; |
| 58 DownsampledRenderBuffer downsampled_render_buffer_; |
46 }; | 59 }; |
47 | 60 |
48 } // namespace test | 61 } // namespace test |
49 } // namespace webrtc | 62 } // namespace webrtc |
50 | 63 |
51 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ | 64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MOCK_MOCK_RENDER_DELAY_BUFFER_H_ |
OLD | NEW |