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 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const MixerAudioSource& audio_source) const override; | 82 const MixerAudioSource& audio_source) const override; |
83 | 83 |
84 private: | 84 private: |
85 // Set/get mix frequency | 85 // Set/get mix frequency |
86 int32_t SetOutputFrequency(const Frequency& frequency); | 86 int32_t SetOutputFrequency(const Frequency& frequency); |
87 Frequency OutputFrequency() const; | 87 Frequency OutputFrequency() const; |
88 | 88 |
89 // Compute what audio sources to mix from audio_source_list_. Ramp in | 89 // Compute what audio sources to mix from audio_source_list_. Ramp in |
90 // and out. Update mixed status. maxAudioFrameCounter specifies how | 90 // and out. Update mixed status. maxAudioFrameCounter specifies how |
91 // many participants are allowed to be mixed. | 91 // many participants are allowed to be mixed. |
92 AudioFrameList UpdateToMix(size_t maxAudioFrameCounter) const; | 92 AudioFrameList UpdateToMix(size_t maxAudioFrameCounter) const |
| 93 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
93 | 94 |
94 // Return the lowest mixing frequency that can be used without having to | 95 // Return the lowest mixing frequency that can be used without having to |
95 // downsample any audio. | 96 // downsample any audio. |
96 int32_t GetLowestMixingFrequency() const; | 97 int32_t GetLowestMixingFrequency() const; |
97 int32_t GetLowestMixingFrequencyFromList( | 98 int32_t GetLowestMixingFrequencyFromList( |
98 const MixerAudioSourceList& mixList) const; | 99 const MixerAudioSourceList& mixList) const; |
99 | 100 |
100 // Return the AudioFrames that should be mixed anonymously. | 101 // Return the AudioFrames that should be mixed anonymously. |
101 void GetAdditionalAudio(AudioFrameList* additionalFramesList) const; | 102 void GetAdditionalAudio(AudioFrameList* additionalFramesList) const |
| 103 EXCLUSIVE_LOCKS_REQUIRED(crit_); |
102 | 104 |
103 // This function returns true if it finds the MixerAudioSource in the | 105 // This function returns true if it finds the MixerAudioSource in the |
104 // specified list of MixerAudioSources. | 106 // specified list of MixerAudioSources. |
105 bool IsAudioSourceInList(const MixerAudioSource& audio_source, | 107 bool IsAudioSourceInList(const MixerAudioSource& audio_source, |
106 const MixerAudioSourceList& audioSourceList) const; | 108 const MixerAudioSourceList& audioSourceList) const; |
107 | 109 |
108 // Add/remove the MixerAudioSource to the specified | 110 // Add/remove the MixerAudioSource to the specified |
109 // MixerAudioSource list. | 111 // MixerAudioSource list. |
110 bool AddAudioSourceToList(MixerAudioSource* audio_source, | 112 bool AddAudioSourceToList(MixerAudioSource* audio_source, |
111 MixerAudioSourceList* audioSourceList) const; | 113 MixerAudioSourceList* audioSourceList) const; |
(...skipping 13 matching lines...) Expand all Loading... |
125 const AudioFrameList& audioFrameList) const; | 127 const AudioFrameList& audioFrameList) const; |
126 | 128 |
127 bool LimitMixedAudio(AudioFrame* mixedAudio) const; | 129 bool LimitMixedAudio(AudioFrame* mixedAudio) const; |
128 | 130 |
129 // Output level functions for VoEVolumeControl. | 131 // Output level functions for VoEVolumeControl. |
130 int GetOutputAudioLevel() override; | 132 int GetOutputAudioLevel() override; |
131 | 133 |
132 int GetOutputAudioLevelFullRange() override; | 134 int GetOutputAudioLevelFullRange() override; |
133 | 135 |
134 std::unique_ptr<CriticalSectionWrapper> crit_; | 136 std::unique_ptr<CriticalSectionWrapper> crit_; |
135 std::unique_ptr<CriticalSectionWrapper> cb_crit_; | |
136 | 137 |
137 int32_t id_; | 138 const int32_t id_; |
138 | 139 |
139 // The current sample frequency and sample size when mixing. | 140 // The current sample frequency and sample size when mixing. |
140 Frequency output_frequency_; | 141 Frequency output_frequency_ ACCESS_ON(&thread_checker_); |
141 size_t sample_size_; | 142 size_t sample_size_ ACCESS_ON(&thread_checker_); |
142 | 143 |
143 // List of all audio sources. Note all lists are disjunct | 144 // List of all audio sources. Note all lists are disjunct |
144 MixerAudioSourceList audio_source_list_; // May be mixed. | 145 MixerAudioSourceList audio_source_list_ GUARDED_BY(crit_); // May be mixed. |
145 | 146 |
146 // Always mixed, anonomously. | 147 // Always mixed, anonomously. |
147 MixerAudioSourceList additional_audio_source_list_; | 148 MixerAudioSourceList additional_audio_source_list_ GUARDED_BY(crit_); |
148 | 149 |
149 size_t num_mixed_audio_sources_; | 150 size_t num_mixed_audio_sources_ GUARDED_BY(crit_); |
150 // Determines if we will use a limiter for clipping protection during | 151 // Determines if we will use a limiter for clipping protection during |
151 // mixing. | 152 // mixing. |
152 bool use_limiter_; | 153 bool use_limiter_ ACCESS_ON(&thread_checker_); |
153 | 154 |
154 uint32_t time_stamp_; | 155 uint32_t time_stamp_ ACCESS_ON(&thread_checker_); |
155 | 156 |
156 // Ensures that Mix is called from the same thread. | 157 // Ensures that Mix is called from the same thread. |
157 rtc::ThreadChecker thread_checker_; | 158 rtc::ThreadChecker thread_checker_; |
158 | 159 |
159 // Used for inhibiting saturation in mixing. | 160 // Used for inhibiting saturation in mixing. |
160 std::unique_ptr<AudioProcessing> limiter_; | 161 std::unique_ptr<AudioProcessing> limiter_ ACCESS_ON(&thread_checker_); |
161 | 162 |
162 // Measures audio level for the combined signal. | 163 // Measures audio level for the combined signal. |
163 voe::AudioLevel audio_level_; | 164 voe::AudioLevel audio_level_ ACCESS_ON(&thread_checker_); |
164 }; | 165 }; |
165 } // namespace webrtc | 166 } // namespace webrtc |
166 | 167 |
167 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ | 168 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
OLD | NEW |