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

Side by Side Diff: webrtc/modules/audio_processing/gain_control_impl.h

Issue 1424663003: Lock scheme #8: Introduced the new locking scheme (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@add_threadcheckers_CL
Patch Set: Created 5 years, 1 month 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) 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_PROCESSING_GAIN_CONTROL_IMPL_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/criticalsection.h"
16 #include "webrtc/base/scoped_ptr.h" 17 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/base/thread_checker.h" 18 #include "webrtc/base/thread_checker.h"
18 #include "webrtc/common_audio/swap_queue.h" 19 #include "webrtc/common_audio/swap_queue.h"
19 #include "webrtc/modules/audio_processing/include/audio_processing.h" 20 #include "webrtc/modules/audio_processing/include/audio_processing.h"
20 #include "webrtc/modules/audio_processing/processing_component.h" 21 #include "webrtc/modules/audio_processing/processing_component.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 namespace { 25 namespace {
25 // Functor to use when supplying a verifier function for the queue item 26 // Functor to use when supplying a verifier function for the queue item
(...skipping 16 matching lines...) Expand all
42 43
43 } // namespace anonymous 44 } // namespace anonymous
44 45
45 class AudioBuffer; 46 class AudioBuffer;
46 class CriticalSectionWrapper; 47 class CriticalSectionWrapper;
47 48
48 class GainControlImpl : public GainControl, 49 class GainControlImpl : public GainControl,
49 public ProcessingComponent { 50 public ProcessingComponent {
50 public: 51 public:
51 GainControlImpl(const AudioProcessing* apm, 52 GainControlImpl(const AudioProcessing* apm,
52 CriticalSectionWrapper* crit, 53 rtc::CriticalSection* crit_render,
54 rtc::CriticalSection* crit_capture,
53 rtc::ThreadChecker* render_thread, 55 rtc::ThreadChecker* render_thread,
54 rtc::ThreadChecker* capture_thread); 56 rtc::ThreadChecker* capture_thread);
55 virtual ~GainControlImpl(); 57 virtual ~GainControlImpl();
56 58
57 int ProcessRenderAudio(AudioBuffer* audio); 59 int ProcessRenderAudio(AudioBuffer* audio);
58 int AnalyzeCaptureAudio(AudioBuffer* audio); 60 int AnalyzeCaptureAudio(AudioBuffer* audio);
59 int ProcessCaptureAudio(AudioBuffer* audio); 61 int ProcessCaptureAudio(AudioBuffer* audio);
60 62
61 // ProcessingComponent implementation. 63 // ProcessingComponent implementation.
62 int Initialize() override; 64 int Initialize() override;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void* CreateHandle() const override; 97 void* CreateHandle() const override;
96 int InitializeHandle(void* handle) const override; 98 int InitializeHandle(void* handle) const override;
97 int ConfigureHandle(void* handle) const override; 99 int ConfigureHandle(void* handle) const override;
98 void DestroyHandle(void* handle) const override; 100 void DestroyHandle(void* handle) const override;
99 int num_handles_required() const override; 101 int num_handles_required() const override;
100 int GetHandleError(void* handle) const override; 102 int GetHandleError(void* handle) const override;
101 103
102 void AllocateRenderQueue(); 104 void AllocateRenderQueue();
103 105
104 const AudioProcessing* apm_; 106 const AudioProcessing* apm_;
105 CriticalSectionWrapper* crit_; 107 rtc::CriticalSection* const crit_render_;
108 rtc::CriticalSection* const crit_capture_;
109 rtc::CriticalSection crit_queue_;
kwiberg-webrtc 2015/10/27 13:15:57 What do you use crit_queue_ for?
peah-webrtc 2015/11/05 11:47:58 Good find! That is a leftover from a fix for a pro
106 const rtc::ThreadChecker* const render_thread_; 110 const rtc::ThreadChecker* const render_thread_;
107 const rtc::ThreadChecker* const capture_thread_; 111 const rtc::ThreadChecker* const capture_thread_;
108 Mode mode_; 112 Mode mode_;
109 int minimum_capture_level_; 113 int minimum_capture_level_;
110 int maximum_capture_level_; 114 int maximum_capture_level_;
111 bool limiter_enabled_; 115 bool limiter_enabled_;
112 int target_level_dbfs_; 116 int target_level_dbfs_;
113 int compression_gain_db_; 117 int compression_gain_db_;
114 std::vector<int> capture_levels_; 118 std::vector<int> capture_levels_;
115 int analog_capture_level_; 119 int analog_capture_level_;
116 bool was_analog_level_set_; 120 bool was_analog_level_set_;
117 bool stream_is_saturated_; 121 bool stream_is_saturated_;
118 122
119 size_t render_queue_element_max_size_; 123 size_t render_queue_element_max_size_;
120 std::vector<int16_t> render_queue_buffer_; 124 std::vector<int16_t> render_queue_buffer_;
121 std::vector<int16_t> capture_queue_buffer_; 125 std::vector<int16_t> capture_queue_buffer_;
122 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> > 126 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> >
123 render_signal_queue_; 127 render_signal_queue_;
124 }; 128 };
125 } // namespace webrtc 129 } // namespace webrtc
126 130
127 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ 131 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698