Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: webrtc/modules/audio_processing/echo_detector/circular_buffer.h

Issue 3011943002: Move optional.h to webrtc/api/ (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 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_ECHO_DETECTOR_CIRCULAR_BUFFER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_CIRCULAR_BUFFER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_CIRCULAR_BUFFER_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_CIRCULAR_BUFFER_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/rtc_base/optional.h" 16 #include "webrtc/api/optional.h"
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 // Ring buffer containing floating point values. 20 // Ring buffer containing floating point values.
21 struct CircularBuffer { 21 struct CircularBuffer {
22 public: 22 public:
23 explicit CircularBuffer(size_t size); 23 explicit CircularBuffer(size_t size);
24 ~CircularBuffer(); 24 ~CircularBuffer();
25 25
26 void Push(float value); 26 void Push(float value);
27 rtc::Optional<float> Pop(); 27 rtc::Optional<float> Pop();
28 size_t Size() const { return nr_elements_in_buffer_; } 28 size_t Size() const { return nr_elements_in_buffer_; }
29 // This function fills the buffer with zeros, but does not change its size. 29 // This function fills the buffer with zeros, but does not change its size.
30 void Clear(); 30 void Clear();
31 31
32 private: 32 private:
33 std::vector<float> buffer_; 33 std::vector<float> buffer_;
34 size_t next_insertion_index_ = 0; 34 size_t next_insertion_index_ = 0;
35 // This is the number of elements that have been pushed into the circular 35 // This is the number of elements that have been pushed into the circular
36 // buffer, not the allocated buffer size. 36 // buffer, not the allocated buffer size.
37 size_t nr_elements_in_buffer_ = 0; 37 size_t nr_elements_in_buffer_ = 0;
38 }; 38 };
39 39
40 } // namespace webrtc 40 } // namespace webrtc
41 41
42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_CIRCULAR_BUFFER_H_ 42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_CIRCULAR_BUFFER_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/beamformer/array_util.h ('k') | webrtc/modules/audio_processing/gain_control_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698