OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ |
12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ |
13 | 13 |
| 14 #include <stddef.h> |
| 15 |
14 #include "webrtc/base/constructormagic.h" | 16 #include "webrtc/base/constructormagic.h" |
15 | 17 |
16 namespace webrtc { | 18 namespace webrtc { |
17 | 19 |
18 class BufferLevelFilter { | 20 class BufferLevelFilter { |
19 public: | 21 public: |
20 BufferLevelFilter(); | 22 BufferLevelFilter(); |
21 virtual ~BufferLevelFilter() {} | 23 virtual ~BufferLevelFilter() {} |
22 virtual void Reset(); | 24 virtual void Reset(); |
23 | 25 |
24 // Updates the filter. Current buffer size is |buffer_size_packets| (Q0). | 26 // Updates the filter. Current buffer size is |buffer_size_packets| (Q0). |
25 // If |time_stretched_samples| is non-zero, the value is converted to the | 27 // If |time_stretched_samples| is non-zero, the value is converted to the |
26 // corresponding number of packets, and is subtracted from the filtered | 28 // corresponding number of packets, and is subtracted from the filtered |
27 // value (thus bypassing the filter operation). |packet_len_samples| is the | 29 // value (thus bypassing the filter operation). |packet_len_samples| is the |
28 // number of audio samples carried in each incoming packet. | 30 // number of audio samples carried in each incoming packet. |
29 virtual void Update(int buffer_size_packets, int time_stretched_samples, | 31 virtual void Update(size_t buffer_size_packets, int time_stretched_samples, |
30 int packet_len_samples); | 32 size_t packet_len_samples); |
31 | 33 |
32 // Set the current target buffer level (obtained from | 34 // Set the current target buffer level (obtained from |
33 // DelayManager::base_target_level()). Used to select the appropriate | 35 // DelayManager::base_target_level()). Used to select the appropriate |
34 // filter coefficient. | 36 // filter coefficient. |
35 virtual void SetTargetBufferLevel(int target_buffer_level); | 37 virtual void SetTargetBufferLevel(int target_buffer_level); |
36 | 38 |
37 virtual int filtered_current_level() const; | 39 virtual int filtered_current_level() const; |
38 | 40 |
39 private: | 41 private: |
40 int level_factor_; // Filter factor for the buffer level filter in Q8. | 42 int level_factor_; // Filter factor for the buffer level filter in Q8. |
41 int filtered_current_level_; // Filtered current buffer level in Q8. | 43 int filtered_current_level_; // Filtered current buffer level in Q8. |
42 | 44 |
43 DISALLOW_COPY_AND_ASSIGN(BufferLevelFilter); | 45 DISALLOW_COPY_AND_ASSIGN(BufferLevelFilter); |
44 }; | 46 }; |
45 | 47 |
46 } // namespace webrtc | 48 } // namespace webrtc |
47 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ | 49 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_BUFFER_LEVEL_FILTER_H_ |
OLD | NEW |