OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
| 13 |
| 14 #include <stddef.h> |
| 15 #include <vector> |
| 16 |
| 17 namespace webrtc { |
| 18 |
| 19 // Class for buffering the incoming render blocks such that these may be |
| 20 // extracted with a specified delay. |
| 21 class RenderDelayBuffer { |
| 22 public: |
| 23 static RenderDelayBuffer* Create(size_t size_blocks, |
| 24 size_t num_bands, |
| 25 size_t max_api_jitter_blocks); |
| 26 virtual ~RenderDelayBuffer() = default; |
| 27 |
| 28 // Swaps a block into the buffer (the content of block is destroyed) and |
| 29 // returns true if the insert is successful. |
| 30 virtual bool Insert(std::vector<std::vector<float>>* block) = 0; |
| 31 |
| 32 // Gets a reference to the next block (having the specified buffer delay) to |
| 33 // read in the buffer. This method can only be called if a block is |
| 34 // available which means that that must be checked prior to the call using |
| 35 // the method IsBlockAvailable(). |
| 36 virtual const std::vector<std::vector<float>>& GetNext() = 0; |
| 37 |
| 38 // Sets the buffer delay. The delay set must be lower than the delay reported |
| 39 // by MaxDelay(). |
| 40 virtual void SetDelay(size_t delay) = 0; |
| 41 |
| 42 // Gets the buffer delay. |
| 43 virtual size_t Delay() const = 0; |
| 44 |
| 45 // Returns the maximum allowed buffer delay increase. |
| 46 virtual size_t MaxDelay() const = 0; |
| 47 |
| 48 // Returns whether a block is available for reading. |
| 49 virtual bool IsBlockAvailable() const = 0; |
| 50 |
| 51 // Returns the maximum allowed api call jitter in blocks. |
| 52 virtual size_t MaxApiJitter() const = 0; |
| 53 }; |
| 54 |
| 55 } // namespace webrtc |
| 56 |
| 57 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_RENDER_DELAY_BUFFER_H_ |
OLD | NEW |