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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 private: | 55 private: |
56 bool _isMixed; | 56 bool _isMixed; |
57 }; | 57 }; |
58 | 58 |
59 class NewAudioConferenceMixerImpl : public NewAudioConferenceMixer { | 59 class NewAudioConferenceMixerImpl : public NewAudioConferenceMixer { |
60 public: | 60 public: |
61 // AudioProcessing only accepts 10 ms frames. | 61 // AudioProcessing only accepts 10 ms frames. |
62 enum { kProcessPeriodicityInMs = 10 }; | 62 enum { kProcessPeriodicityInMs = 10 }; |
63 | 63 |
64 explicit NewAudioConferenceMixerImpl(int id); | 64 explicit NewAudioConferenceMixerImpl(int id); |
65 ~NewAudioConferenceMixerImpl(); | 65 // The dtor not needed, because this class does no longer manage |
| 66 // memory. |
66 | 67 |
67 // Must be called after ctor. | 68 // Must be called after ctor. |
68 bool Init(); | 69 bool Init(); |
69 | 70 |
70 // NewAudioConferenceMixer functions | 71 // NewAudioConferenceMixer functions |
71 int32_t SetMixabilityStatus(MixerAudioSource* audio_source, | 72 int32_t SetMixabilityStatus(MixerAudioSource* audio_source, |
72 bool mixable) override; | 73 bool mixable) override; |
73 bool MixabilityStatus(const MixerAudioSource& audio_source) const override; | 74 bool MixabilityStatus(const MixerAudioSource& audio_source) const override; |
74 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, | 75 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, |
75 bool mixable) override; | 76 bool mixable) override; |
76 void Mix(AudioFrame* audio_frame_for_mixing) override; | 77 void Mix(AudioFrame* audio_frame_for_mixing) override; |
77 int32_t SetMinimumMixingFrequency(Frequency freq) override; | 78 int32_t SetMinimumMixingFrequency(Frequency freq) override; |
78 bool AnonymousMixabilityStatus( | 79 bool AnonymousMixabilityStatus( |
79 const MixerAudioSource& audio_source) const override; | 80 const MixerAudioSource& audio_source) const override; |
80 | 81 |
81 private: | 82 private: |
82 enum { DEFAULT_AUDIO_FRAME_POOLSIZE = 50 }; | |
83 | |
84 // Set/get mix frequency | 83 // Set/get mix frequency |
85 int32_t SetOutputFrequency(const Frequency& frequency); | 84 int32_t SetOutputFrequency(const Frequency& frequency); |
86 Frequency OutputFrequency() const; | 85 Frequency OutputFrequency() const; |
87 | 86 |
88 // Fills mixList with the AudioFrames pointers that should be used when | 87 // Fills mixList with the AudioFrames pointers that should be used when |
89 // mixing. | 88 // mixing. |
90 // maxAudioFrameCounter both input and output specifies how many more | 89 // maxAudioFrameCounter both input and output specifies how many more |
91 // AudioFrames that are allowed to be mixed. | 90 // AudioFrames that are allowed to be mixed. |
92 // rampOutList contain AudioFrames corresponding to an audio stream that | 91 // rampOutList contain AudioFrames corresponding to an audio stream that |
93 // used to be mixed but shouldn't be mixed any longer. These AudioFrames | 92 // used to be mixed but shouldn't be mixed any longer. These AudioFrames |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 std::unique_ptr<CriticalSectionWrapper> _cbCrit; | 143 std::unique_ptr<CriticalSectionWrapper> _cbCrit; |
145 | 144 |
146 int32_t _id; | 145 int32_t _id; |
147 | 146 |
148 Frequency _minimumMixingFreq; | 147 Frequency _minimumMixingFreq; |
149 | 148 |
150 // The current sample frequency and sample size when mixing. | 149 // The current sample frequency and sample size when mixing. |
151 Frequency _outputFrequency; | 150 Frequency _outputFrequency; |
152 size_t _sampleSize; | 151 size_t _sampleSize; |
153 | 152 |
154 // Memory pool to avoid allocating/deallocating AudioFrames | |
155 MemoryPool<AudioFrame>* _audioFramePool; | |
156 | |
157 // List of all audio sources. Note all lists are disjunct | 153 // List of all audio sources. Note all lists are disjunct |
158 MixerAudioSourceList audio_source_list_; // May be mixed. | 154 MixerAudioSourceList audio_source_list_; // May be mixed. |
| 155 |
159 // Always mixed, anonomously. | 156 // Always mixed, anonomously. |
160 MixerAudioSourceList additional_audio_source_list_; | 157 MixerAudioSourceList additional_audio_source_list_; |
161 | 158 |
162 size_t num_mixed_audio_sources_; | 159 size_t num_mixed_audio_sources_; |
163 // Determines if we will use a limiter for clipping protection during | 160 // Determines if we will use a limiter for clipping protection during |
164 // mixing. | 161 // mixing. |
165 bool use_limiter_; | 162 bool use_limiter_; |
166 | 163 |
167 uint32_t _timeStamp; | 164 uint32_t _timeStamp; |
168 | 165 |
169 // Ensures that Mix is called from the same thread. | 166 // Ensures that Mix is called from the same thread. |
170 rtc::ThreadChecker thread_checker_; | 167 rtc::ThreadChecker thread_checker_; |
171 | 168 |
172 // Used for inhibiting saturation in mixing. | 169 // Used for inhibiting saturation in mixing. |
173 std::unique_ptr<AudioProcessing> _limiter; | 170 std::unique_ptr<AudioProcessing> _limiter; |
174 }; | 171 }; |
175 } // namespace webrtc | 172 } // namespace webrtc |
176 | 173 |
177 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ | 174 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ |
OLD | NEW |