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

Side by Side Diff: webrtc/base/swap_queue.h

Issue 2665693002: Moves channel-dependent audio input processing to separate encoder task queue (Closed)
Patch Set: cleanup Created 3 years, 9 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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 // Same as above and accepts an item verification functor. 99 // Same as above and accepts an item verification functor.
100 SwapQueue(size_t size, 100 SwapQueue(size_t size,
101 const T& prototype, 101 const T& prototype,
102 const QueueItemVerifier& queue_item_verifier) 102 const QueueItemVerifier& queue_item_verifier)
103 : queue_item_verifier_(queue_item_verifier), queue_(size, prototype) { 103 : queue_item_verifier_(queue_item_verifier), queue_(size, prototype) {
104 RTC_DCHECK(VerifyQueueSlots()); 104 RTC_DCHECK(VerifyQueueSlots());
105 } 105 }
106 106
107 size_t Capacity() const { return queue_.size(); }
108
109 size_t Size() const {
110 rtc::CritScope cs(&crit_queue_);
111 return num_elements_;
tommi 2017/03/28 13:01:40 returning a value that requires a lock? (the retu
112 }
113
107 // Resets the queue to have zero content wile maintaining the queue size. 114 // Resets the queue to have zero content wile maintaining the queue size.
108 void Clear() { 115 void Clear() {
109 rtc::CritScope cs(&crit_queue_); 116 rtc::CritScope cs(&crit_queue_);
110 next_write_index_ = 0; 117 next_write_index_ = 0;
111 next_read_index_ = 0; 118 next_read_index_ = 0;
112 num_elements_ = 0; 119 num_elements_ = 0;
113 } 120 }
114 121
115 // Inserts a "full" T at the back of the queue by swapping *input with an 122 // Inserts a "full" T at the back of the queue by swapping *input with an
116 // "empty" T from the queue. 123 // "empty" T from the queue.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 209
203 // queue_.size() is constant. 210 // queue_.size() is constant.
204 std::vector<T> queue_ GUARDED_BY(crit_queue_); 211 std::vector<T> queue_ GUARDED_BY(crit_queue_);
205 212
206 RTC_DISALLOW_COPY_AND_ASSIGN(SwapQueue); 213 RTC_DISALLOW_COPY_AND_ASSIGN(SwapQueue);
207 }; 214 };
208 215
209 } // namespace webrtc 216 } // namespace webrtc
210 217
211 #endif // WEBRTC_BASE_SWAP_QUEUE_H_ 218 #endif // WEBRTC_BASE_SWAP_QUEUE_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/swap_queue_unittest.cc » ('j') | webrtc/modules/audio_device/audio_device_buffer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698