OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ |
12 #define WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ~NewAudioConferenceMixerImpl(); | 65 ~NewAudioConferenceMixerImpl(); |
66 | 66 |
67 // Must be called after ctor. | 67 // Must be called after ctor. |
68 bool Init(); | 68 bool Init(); |
69 | 69 |
70 // Module functions | 70 // Module functions |
71 int64_t TimeUntilNextProcess() override; | 71 int64_t TimeUntilNextProcess() override; |
72 void Process() override; | 72 void Process() override; |
73 | 73 |
74 // NewAudioConferenceMixer functions | 74 // NewAudioConferenceMixer functions |
75 int32_t RegisterMixedStreamCallback( | |
76 OldAudioMixerOutputReceiver* mixReceiver) override; | |
77 int32_t UnRegisterMixedStreamCallback() override; | |
78 int32_t SetMixabilityStatus(MixerAudioSource* participant, | 75 int32_t SetMixabilityStatus(MixerAudioSource* participant, |
79 bool mixable) override; | 76 bool mixable) override; |
80 bool MixabilityStatus(const MixerAudioSource& participant) const override; | 77 bool MixabilityStatus(const MixerAudioSource& participant) const override; |
81 int32_t SetMinimumMixingFrequency(Frequency freq) override; | |
82 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* participant, | 78 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* participant, |
83 bool mixable) override; | 79 bool mixable) override; |
| 80 void Mix(AudioFrame* audio_frame_for_mixing) override; |
| 81 int32_t SetMinimumMixingFrequency(Frequency freq) override; |
84 bool AnonymousMixabilityStatus( | 82 bool AnonymousMixabilityStatus( |
85 const MixerAudioSource& participant) const override; | 83 const MixerAudioSource& participant) const override; |
86 | 84 |
87 private: | 85 private: |
88 enum { DEFAULT_AUDIO_FRAME_POOLSIZE = 50 }; | 86 enum { DEFAULT_AUDIO_FRAME_POOLSIZE = 50 }; |
89 | 87 |
90 // Set/get mix frequency | 88 // Set/get mix frequency |
91 int32_t SetOutputFrequency(const Frequency& frequency); | 89 int32_t SetOutputFrequency(const Frequency& frequency); |
92 Frequency OutputFrequency() const; | 90 Frequency OutputFrequency() const; |
93 | 91 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const MixerAudioSourceList& participantList) const; | 124 const MixerAudioSourceList& participantList) const; |
127 | 125 |
128 // Add/remove the MixerAudioSource to the specified | 126 // Add/remove the MixerAudioSource to the specified |
129 // MixerAudioSource list. | 127 // MixerAudioSource list. |
130 bool AddParticipantToList(MixerAudioSource* participant, | 128 bool AddParticipantToList(MixerAudioSource* participant, |
131 MixerAudioSourceList* participantList) const; | 129 MixerAudioSourceList* participantList) const; |
132 bool RemoveParticipantFromList(MixerAudioSource* removeParticipant, | 130 bool RemoveParticipantFromList(MixerAudioSource* removeParticipant, |
133 MixerAudioSourceList* participantList) const; | 131 MixerAudioSourceList* participantList) const; |
134 | 132 |
135 // Mix the AudioFrames stored in audioFrameList into mixedAudio. | 133 // Mix the AudioFrames stored in audioFrameList into mixedAudio. |
136 int32_t MixFromList(AudioFrame* mixedAudio, | 134 static int32_t MixFromList(AudioFrame* mixedAudio, |
137 const AudioFrameList& audioFrameList) const; | 135 const AudioFrameList& audioFrameList, |
| 136 int32_t id, |
| 137 bool use_limiter); |
138 | 138 |
139 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No | 139 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No |
140 // record will be kept of this mix (e.g. the corresponding MixerAudioSources | 140 // record will be kept of this mix (e.g. the corresponding MixerAudioSources |
141 // will not be marked as IsMixed() | 141 // will not be marked as IsMixed() |
142 int32_t MixAnonomouslyFromList(AudioFrame* mixedAudio, | 142 int32_t MixAnonomouslyFromList(AudioFrame* mixedAudio, |
143 const AudioFrameList& audioFrameList) const; | 143 const AudioFrameList& audioFrameList) const; |
144 | 144 |
145 bool LimitMixedAudio(AudioFrame* mixedAudio) const; | 145 bool LimitMixedAudio(AudioFrame* mixedAudio) const; |
146 | 146 |
147 std::unique_ptr<CriticalSectionWrapper> _crit; | 147 std::unique_ptr<CriticalSectionWrapper> _crit; |
148 std::unique_ptr<CriticalSectionWrapper> _cbCrit; | 148 std::unique_ptr<CriticalSectionWrapper> _cbCrit; |
149 | 149 |
150 int32_t _id; | 150 int32_t _id; |
151 | 151 |
152 Frequency _minimumMixingFreq; | 152 Frequency _minimumMixingFreq; |
153 | 153 |
154 // Mix result callback | |
155 OldAudioMixerOutputReceiver* _mixReceiver; | |
156 | |
157 // The current sample frequency and sample size when mixing. | 154 // The current sample frequency and sample size when mixing. |
158 Frequency _outputFrequency; | 155 Frequency _outputFrequency; |
159 size_t _sampleSize; | 156 size_t _sampleSize; |
160 | 157 |
161 // Memory pool to avoid allocating/deallocating AudioFrames | 158 // Memory pool to avoid allocating/deallocating AudioFrames |
162 MemoryPool<AudioFrame>* _audioFramePool; | 159 MemoryPool<AudioFrame>* _audioFramePool; |
163 | 160 |
164 // List of all participants. Note all lists are disjunct | 161 // List of all participants. Note all lists are disjunct |
165 MixerAudioSourceList _participantList; // May be mixed. | 162 MixerAudioSourceList _participantList; // May be mixed. |
166 // Always mixed, anonomously. | 163 // Always mixed, anonomously. |
(...skipping 12 matching lines...) Expand all Loading... |
179 // Counter keeping track of concurrent calls to process. | 176 // Counter keeping track of concurrent calls to process. |
180 // Note: should never be higher than 1 or lower than 0. | 177 // Note: should never be higher than 1 or lower than 0. |
181 int16_t _processCalls; | 178 int16_t _processCalls; |
182 | 179 |
183 // Used for inhibiting saturation in mixing. | 180 // Used for inhibiting saturation in mixing. |
184 std::unique_ptr<AudioProcessing> _limiter; | 181 std::unique_ptr<AudioProcessing> _limiter; |
185 }; | 182 }; |
186 } // namespace webrtc | 183 } // namespace webrtc |
187 | 184 |
188 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ | 185 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ |
OLD | NEW |