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

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

Issue 1422013002: Preparational work for an upcoming addition of a threadchecking scheme for APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@bundling_of_state_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/scoped_ptr.h" 16 #include "webrtc/base/scoped_ptr.h"
17 #include "webrtc/base/thread_checker.h"
17 #include "webrtc/common_audio/swap_queue.h" 18 #include "webrtc/common_audio/swap_queue.h"
18 #include "webrtc/modules/audio_processing/include/audio_processing.h" 19 #include "webrtc/modules/audio_processing/include/audio_processing.h"
19 #include "webrtc/modules/audio_processing/processing_component.h" 20 #include "webrtc/modules/audio_processing/processing_component.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 23
23 namespace { 24 namespace {
24 // Functor to use when supplying a verifier function for the queue item 25 // Functor to use when supplying a verifier function for the queue item
25 // verifcation. 26 // verifcation.
26 class AgcRenderQueueItemVerifier { 27 class AgcRenderQueueItemVerifier {
(...skipping 14 matching lines...) Expand all
41 42
42 } // namespace anonymous 43 } // namespace anonymous
43 44
44 class AudioBuffer; 45 class AudioBuffer;
45 class CriticalSectionWrapper; 46 class CriticalSectionWrapper;
46 47
47 class GainControlImpl : public GainControl, 48 class GainControlImpl : public GainControl,
48 public ProcessingComponent { 49 public ProcessingComponent {
49 public: 50 public:
50 GainControlImpl(const AudioProcessing* apm, 51 GainControlImpl(const AudioProcessing* apm,
51 CriticalSectionWrapper* crit); 52 CriticalSectionWrapper* crit,
53 rtc::ThreadChecker* render_thread,
54 rtc::ThreadChecker* capture_thread);
52 virtual ~GainControlImpl(); 55 virtual ~GainControlImpl();
53 56
54 int ProcessRenderAudio(AudioBuffer* audio); 57 int ProcessRenderAudio(AudioBuffer* audio);
55 int AnalyzeCaptureAudio(AudioBuffer* audio); 58 int AnalyzeCaptureAudio(AudioBuffer* audio);
56 int ProcessCaptureAudio(AudioBuffer* audio); 59 int ProcessCaptureAudio(AudioBuffer* audio);
57 60
58 // ProcessingComponent implementation. 61 // ProcessingComponent implementation.
59 int Initialize() override; 62 int Initialize() override;
60 63
61 // GainControl implementation. 64 // GainControl implementation.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 int InitializeHandle(void* handle) const override; 96 int InitializeHandle(void* handle) const override;
94 int ConfigureHandle(void* handle) const override; 97 int ConfigureHandle(void* handle) const override;
95 void DestroyHandle(void* handle) const override; 98 void DestroyHandle(void* handle) const override;
96 int num_handles_required() const override; 99 int num_handles_required() const override;
97 int GetHandleError(void* handle) const override; 100 int GetHandleError(void* handle) const override;
98 101
99 void AllocateRenderQueue(); 102 void AllocateRenderQueue();
100 103
101 const AudioProcessing* apm_; 104 const AudioProcessing* apm_;
102 CriticalSectionWrapper* crit_; 105 CriticalSectionWrapper* crit_;
106 const rtc::ThreadChecker* const render_thread_;
107 const rtc::ThreadChecker* const capture_thread_;
103 Mode mode_; 108 Mode mode_;
104 int minimum_capture_level_; 109 int minimum_capture_level_;
105 int maximum_capture_level_; 110 int maximum_capture_level_;
106 bool limiter_enabled_; 111 bool limiter_enabled_;
107 int target_level_dbfs_; 112 int target_level_dbfs_;
108 int compression_gain_db_; 113 int compression_gain_db_;
109 std::vector<int> capture_levels_; 114 std::vector<int> capture_levels_;
110 int analog_capture_level_; 115 int analog_capture_level_;
111 bool was_analog_level_set_; 116 bool was_analog_level_set_;
112 bool stream_is_saturated_; 117 bool stream_is_saturated_;
113 118
114 size_t render_queue_element_max_size_; 119 size_t render_queue_element_max_size_;
115 std::vector<int16_t> render_queue_buffer_; 120 std::vector<int16_t> render_queue_buffer_;
116 std::vector<int16_t> capture_queue_buffer_; 121 std::vector<int16_t> capture_queue_buffer_;
117 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> > 122 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AgcRenderQueueItemVerifier> >
118 render_signal_queue_; 123 render_signal_queue_;
119 }; 124 };
120 } // namespace webrtc 125 } // namespace webrtc
121 126
122 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ 127 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698