Chromium Code Reviews| 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_RENDER_DELAY_BUFFER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
| 13 | 13 |
| 14 #include <stddef.h> | 14 #include <stddef.h> |
| 15 #include <array> | |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 18 #include "webrtc/base/array_view.h" | |
| 19 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" | |
| 20 #include "webrtc/modules/audio_processing/aec3/downsampled_render_buffer.h" | |
| 21 #include "webrtc/modules/audio_processing/aec3/fft_data.h" | |
| 22 #include "webrtc/modules/audio_processing/aec3/render_buffer.h" | |
| 23 | |
| 17 namespace webrtc { | 24 namespace webrtc { |
| 18 | 25 |
| 19 // Class for buffering the incoming render blocks such that these may be | 26 // Class for buffering the incoming render blocks such that these may be |
| 20 // extracted with a specified delay. | 27 // extracted with a specified delay. |
| 21 class RenderDelayBuffer { | 28 class RenderDelayBuffer { |
| 22 public: | 29 public: |
| 23 static RenderDelayBuffer* Create(size_t size_blocks, | 30 static RenderDelayBuffer* Create(size_t num_bands); |
| 24 size_t num_bands, | |
| 25 size_t max_api_jitter_blocks); | |
| 26 virtual ~RenderDelayBuffer() = default; | 31 virtual ~RenderDelayBuffer() = default; |
| 27 | 32 |
| 33 // Resets the buffer data. | |
| 34 virtual void Reset() = 0; | |
| 35 | |
| 28 // Swaps a block into the buffer (the content of block is destroyed) and | 36 // Swaps a block into the buffer (the content of block is destroyed) and |
| 29 // returns true if the insert is successful. | 37 // returns true if the insert is successful. |
|
aleloi
2017/04/04 12:18:50
I think the comment should be updated. Also, since
peah-webrtc
2017/04/04 13:57:11
Done.
| |
| 30 virtual bool Insert(std::vector<std::vector<float>>* block) = 0; | 38 virtual bool Insert(std::vector<std::vector<float>>* block) = 0; |
| 31 | 39 |
| 32 // Gets a reference to the next block (having the specified buffer delay) to | 40 // Updates the buffers one step based on the specified buffer delay. Returns |
| 33 // read in the buffer. This method can only be called if a block is | 41 // true if there was no overrun, otherwise returns false. |
| 34 // available which means that that must be checked prior to the call using | 42 virtual bool UpdateBuffers() = 0; |
| 35 // the method IsBlockAvailable(). | |
| 36 virtual const std::vector<std::vector<float>>& GetNext() = 0; | |
| 37 | 43 |
| 38 // Sets the buffer delay. The delay set must be lower than the delay reported | 44 // Sets the buffer delay. |
| 39 // by MaxDelay(). | |
| 40 virtual void SetDelay(size_t delay) = 0; | 45 virtual void SetDelay(size_t delay) = 0; |
| 41 | 46 |
| 42 // Gets the buffer delay. | 47 // Gets the buffer delay. |
| 43 virtual size_t Delay() const = 0; | 48 virtual size_t Delay() const = 0; |
| 44 | 49 |
| 45 // Returns the maximum allowed buffer delay increase. | 50 // Returns the render buffer for the echo remover. |
| 46 virtual size_t MaxDelay() const = 0; | 51 virtual const RenderBuffer& GetRenderBuffer() const = 0; |
| 47 | 52 |
| 48 // Returns whether a block is available for reading. | 53 // Returns the downsampled render buffer. |
| 49 virtual bool IsBlockAvailable() const = 0; | 54 virtual const DownsampledRenderBuffer& GetDownsampledRenderBuffer() const = 0; |
| 50 | |
| 51 // Returns the maximum allowed api call jitter in blocks. | |
| 52 virtual size_t MaxApiJitter() const = 0; | |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 } // namespace webrtc | 57 } // namespace webrtc |
| 56 | 58 |
| 57 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ | 59 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
| OLD | NEW |