| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool Init(); | 64 bool Init(); |
| 65 | 65 |
| 66 // Module functions | 66 // Module functions |
| 67 int64_t TimeUntilNextProcess() override; | 67 int64_t TimeUntilNextProcess() override; |
| 68 int32_t Process() override; | 68 int32_t Process() override; |
| 69 | 69 |
| 70 // AudioConferenceMixer functions | 70 // AudioConferenceMixer functions |
| 71 int32_t RegisterMixedStreamCallback( | 71 int32_t RegisterMixedStreamCallback( |
| 72 AudioMixerOutputReceiver& mixReceiver) override; | 72 AudioMixerOutputReceiver& mixReceiver) override; |
| 73 int32_t UnRegisterMixedStreamCallback() override; | 73 int32_t UnRegisterMixedStreamCallback() override; |
| 74 int32_t RegisterMixerStatusCallback( | |
| 75 AudioMixerStatusReceiver& mixerStatusCallback, | |
| 76 const uint32_t amountOf10MsBetweenCallbacks) override; | |
| 77 int32_t UnRegisterMixerStatusCallback() override; | |
| 78 int32_t SetMixabilityStatus(MixerParticipant& participant, | 74 int32_t SetMixabilityStatus(MixerParticipant& participant, |
| 79 bool mixable) override; | 75 bool mixable) override; |
| 80 int32_t MixabilityStatus(MixerParticipant& participant, | 76 int32_t MixabilityStatus(MixerParticipant& participant, |
| 81 bool& mixable) override; | 77 bool& mixable) override; |
| 82 int32_t SetMinimumMixingFrequency(Frequency freq) override; | 78 int32_t SetMinimumMixingFrequency(Frequency freq) override; |
| 83 int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant, | 79 int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant, |
| 84 const bool mixable) override; | 80 const bool mixable) override; |
| 85 int32_t AnonymousMixabilityStatus(MixerParticipant& participant, | 81 int32_t AnonymousMixabilityStatus(MixerParticipant& participant, |
| 86 bool& mixable) override; | 82 bool& mixable) override; |
| 87 | 83 |
| 88 private: | 84 private: |
| 89 enum{DEFAULT_AUDIO_FRAME_POOLSIZE = 50}; | 85 enum{DEFAULT_AUDIO_FRAME_POOLSIZE = 50}; |
| 90 | 86 |
| 91 // Set/get mix frequency | 87 // Set/get mix frequency |
| 92 int32_t SetOutputFrequency(const Frequency frequency); | 88 int32_t SetOutputFrequency(const Frequency frequency); |
| 93 Frequency OutputFrequency() const; | 89 Frequency OutputFrequency() const; |
| 94 | 90 |
| 95 // Fills mixList with the AudioFrames pointers that should be used when | 91 // Fills mixList with the AudioFrames pointers that should be used when |
| 96 // mixing. Fills mixParticipantList with ParticipantStatistics for the | 92 // mixing. |
| 97 // participants who's AudioFrames are inside mixList. | |
| 98 // maxAudioFrameCounter both input and output specifies how many more | 93 // maxAudioFrameCounter both input and output specifies how many more |
| 99 // AudioFrames that are allowed to be mixed. | 94 // AudioFrames that are allowed to be mixed. |
| 100 // rampOutList contain AudioFrames corresponding to an audio stream that | 95 // rampOutList contain AudioFrames corresponding to an audio stream that |
| 101 // used to be mixed but shouldn't be mixed any longer. These AudioFrames | 96 // used to be mixed but shouldn't be mixed any longer. These AudioFrames |
| 102 // should be ramped out over this AudioFrame to avoid audio discontinuities. | 97 // should be ramped out over this AudioFrame to avoid audio discontinuities. |
| 103 void UpdateToMix( | 98 void UpdateToMix( |
| 104 AudioFrameList* mixList, | 99 AudioFrameList* mixList, |
| 105 AudioFrameList* rampOutList, | 100 AudioFrameList* rampOutList, |
| 106 std::map<int, MixerParticipant*>* mixParticipantList, | 101 std::map<int, MixerParticipant*>* mixParticipantList, |
| 107 size_t& maxAudioFrameCounter); | 102 size_t& maxAudioFrameCounter); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 AudioFrame& mixedAudio, | 142 AudioFrame& mixedAudio, |
| 148 const AudioFrameList* audioFrameList); | 143 const AudioFrameList* audioFrameList); |
| 149 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No | 144 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No |
| 150 // record will be kept of this mix (e.g. the corresponding MixerParticipants | 145 // record will be kept of this mix (e.g. the corresponding MixerParticipants |
| 151 // will not be marked as IsMixed() | 146 // will not be marked as IsMixed() |
| 152 int32_t MixAnonomouslyFromList(AudioFrame& mixedAudio, | 147 int32_t MixAnonomouslyFromList(AudioFrame& mixedAudio, |
| 153 const AudioFrameList* audioFrameList); | 148 const AudioFrameList* audioFrameList); |
| 154 | 149 |
| 155 bool LimitMixedAudio(AudioFrame& mixedAudio); | 150 bool LimitMixedAudio(AudioFrame& mixedAudio); |
| 156 | 151 |
| 157 // Scratch memory | |
| 158 // Note that the scratch memory may only be touched in the scope of | |
| 159 // Process(). | |
| 160 size_t _scratchParticipantsToMixAmount; | |
| 161 ParticipantStatistics _scratchMixedParticipants[ | |
| 162 kMaximumAmountOfMixedParticipants]; | |
| 163 uint32_t _scratchVadPositiveParticipantsAmount; | |
| 164 ParticipantStatistics _scratchVadPositiveParticipants[ | |
| 165 kMaximumAmountOfMixedParticipants]; | |
| 166 | |
| 167 rtc::scoped_ptr<CriticalSectionWrapper> _crit; | 152 rtc::scoped_ptr<CriticalSectionWrapper> _crit; |
| 168 rtc::scoped_ptr<CriticalSectionWrapper> _cbCrit; | 153 rtc::scoped_ptr<CriticalSectionWrapper> _cbCrit; |
| 169 | 154 |
| 170 int32_t _id; | 155 int32_t _id; |
| 171 | 156 |
| 172 Frequency _minimumMixingFreq; | 157 Frequency _minimumMixingFreq; |
| 173 | 158 |
| 174 // Mix result callback | 159 // Mix result callback |
| 175 AudioMixerOutputReceiver* _mixReceiver; | 160 AudioMixerOutputReceiver* _mixReceiver; |
| 176 | 161 |
| 177 AudioMixerStatusReceiver* _mixerStatusCallback; | |
| 178 uint32_t _amountOf10MsBetweenCallbacks; | |
| 179 uint32_t _amountOf10MsUntilNextCallback; | |
| 180 bool _mixerStatusCb; | |
| 181 | |
| 182 // The current sample frequency and sample size when mixing. | 162 // The current sample frequency and sample size when mixing. |
| 183 Frequency _outputFrequency; | 163 Frequency _outputFrequency; |
| 184 uint16_t _sampleSize; | 164 uint16_t _sampleSize; |
| 185 | 165 |
| 186 // Memory pool to avoid allocating/deallocating AudioFrames | 166 // Memory pool to avoid allocating/deallocating AudioFrames |
| 187 MemoryPool<AudioFrame>* _audioFramePool; | 167 MemoryPool<AudioFrame>* _audioFramePool; |
| 188 | 168 |
| 189 // List of all participants. Note all lists are disjunct | 169 // List of all participants. Note all lists are disjunct |
| 190 MixerParticipantList _participantList; // May be mixed. | 170 MixerParticipantList _participantList; // May be mixed. |
| 191 // Always mixed, anonomously. | 171 // Always mixed, anonomously. |
| 192 MixerParticipantList _additionalParticipantList; | 172 MixerParticipantList _additionalParticipantList; |
| 193 | 173 |
| 194 size_t _numMixedParticipants; | 174 size_t _numMixedParticipants; |
| 195 // Determines if we will use a limiter for clipping protection during | 175 // Determines if we will use a limiter for clipping protection during |
| 196 // mixing. | 176 // mixing. |
| 197 bool use_limiter_; | 177 bool use_limiter_; |
| 198 | 178 |
| 199 uint32_t _timeStamp; | 179 uint32_t _timeStamp; |
| 200 | 180 |
| 201 // Metronome class. | 181 // Metronome class. |
| 202 TimeScheduler _timeScheduler; | 182 TimeScheduler _timeScheduler; |
| 203 | 183 |
| 204 // Smooth level indicator. | |
| 205 LevelIndicator _mixedAudioLevel; | |
| 206 | |
| 207 // Counter keeping track of concurrent calls to process. | 184 // Counter keeping track of concurrent calls to process. |
| 208 // Note: should never be higher than 1 or lower than 0. | 185 // Note: should never be higher than 1 or lower than 0. |
| 209 int16_t _processCalls; | 186 int16_t _processCalls; |
| 210 | 187 |
| 211 // Used for inhibiting saturation in mixing. | 188 // Used for inhibiting saturation in mixing. |
| 212 rtc::scoped_ptr<AudioProcessing> _limiter; | 189 rtc::scoped_ptr<AudioProcessing> _limiter; |
| 213 }; | 190 }; |
| 214 } // namespace webrtc | 191 } // namespace webrtc |
| 215 | 192 |
| 216 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_AUDIO_CONFERENCE_MIXER_IM
PL_H_ | 193 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_AUDIO_CONFERENCE_MIXER_IM
PL_H_ |
| OLD | NEW |