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