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 18 matching lines...) Expand all Loading... | |
29 typedef std::list<MixerParticipant*> MixerParticipantList; | 29 typedef std::list<MixerParticipant*> MixerParticipantList; |
30 | 30 |
31 // Cheshire cat implementation of MixerParticipant's non virtual functions. | 31 // Cheshire cat implementation of MixerParticipant's non virtual functions. |
32 class MixHistory | 32 class MixHistory |
33 { | 33 { |
34 public: | 34 public: |
35 MixHistory(); | 35 MixHistory(); |
36 ~MixHistory(); | 36 ~MixHistory(); |
37 | 37 |
38 // MixerParticipant function | 38 // MixerParticipant function |
39 int32_t IsMixed(bool& mixed) const; | 39 int32_t IsMixed(bool* mixed) const; |
Andrew MacDonald
2015/08/26 15:56:01
Return bool on both of these?
minyue-webrtc
2015/08/27 11:31:15
Done.
| |
40 | 40 |
41 // Sets wasMixed to true if the participant was mixed previous mix | 41 // Sets wasMixed to true if the participant was mixed previous mix |
42 // iteration. | 42 // iteration. |
43 int32_t WasMixed(bool& wasMixed) const; | 43 int32_t WasMixed(bool* wasMixed) const; |
44 | 44 |
45 // Updates the mixed status. | 45 // Updates the mixed status. |
46 int32_t SetIsMixed(const bool mixed); | 46 int32_t SetIsMixed(const bool mixed); |
47 | 47 |
48 void ResetMixedStatus(); | 48 void ResetMixedStatus(); |
49 private: | 49 private: |
50 bool _isMixed; | 50 bool _isMixed; |
51 }; | 51 }; |
52 | 52 |
53 class AudioConferenceMixerImpl : public AudioConferenceMixer | 53 class AudioConferenceMixerImpl : public AudioConferenceMixer |
54 { | 54 { |
55 public: | 55 public: |
56 // AudioProcessing only accepts 10 ms frames. | 56 // AudioProcessing only accepts 10 ms frames. |
57 enum {kProcessPeriodicityInMs = 10}; | 57 enum {kProcessPeriodicityInMs = 10}; |
58 | 58 |
59 AudioConferenceMixerImpl(int id); | 59 AudioConferenceMixerImpl(int id); |
60 ~AudioConferenceMixerImpl(); | 60 ~AudioConferenceMixerImpl(); |
61 | 61 |
62 // Must be called after ctor. | 62 // Must be called after ctor. |
63 bool Init(); | 63 bool Init(); |
64 | 64 |
65 // Module functions | 65 // Module functions |
66 int64_t TimeUntilNextProcess() override; | 66 int64_t TimeUntilNextProcess() override; |
67 int32_t Process() override; | 67 int32_t Process() override; |
68 | 68 |
69 // AudioConferenceMixer functions | 69 // AudioConferenceMixer functions |
70 int32_t RegisterMixedStreamCallback( | 70 int32_t RegisterMixedStreamCallback( |
71 AudioMixerOutputReceiver& mixReceiver) override; | 71 AudioMixerOutputReceiver* mixReceiver) override; |
72 int32_t UnRegisterMixedStreamCallback() override; | 72 int32_t UnRegisterMixedStreamCallback() override; |
73 int32_t SetMixabilityStatus(MixerParticipant& participant, | 73 int32_t SetMixabilityStatus(MixerParticipant* participant, |
74 bool mixable) override; | 74 bool mixable) override; |
75 int32_t MixabilityStatus(MixerParticipant& participant, | 75 int32_t MixabilityStatus(const MixerParticipant& participant, |
76 bool& mixable) override; | 76 bool* mixable) const override; |
77 int32_t SetMinimumMixingFrequency(Frequency freq) override; | 77 int32_t SetMinimumMixingFrequency(Frequency freq) override; |
78 int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant, | 78 int32_t SetAnonymousMixabilityStatus( |
79 const bool mixable) override; | 79 MixerParticipant* participant, bool mixable) override; |
80 int32_t AnonymousMixabilityStatus(MixerParticipant& participant, | 80 int32_t AnonymousMixabilityStatus(const MixerParticipant& participant, |
81 bool& mixable) override; | 81 bool* mixable) const override; |
82 | 82 |
83 private: | 83 private: |
84 enum{DEFAULT_AUDIO_FRAME_POOLSIZE = 50}; | 84 enum{DEFAULT_AUDIO_FRAME_POOLSIZE = 50}; |
85 | 85 |
86 // Set/get mix frequency | 86 // Set/get mix frequency |
87 int32_t SetOutputFrequency(const Frequency frequency); | 87 int32_t SetOutputFrequency(const Frequency& frequency); |
88 Frequency OutputFrequency() const; | 88 Frequency OutputFrequency() const; |
89 | 89 |
90 // Fills mixList with the AudioFrames pointers that should be used when | 90 // Fills mixList with the AudioFrames pointers that should be used when |
91 // mixing. | 91 // mixing. |
92 // maxAudioFrameCounter both input and output specifies how many more | 92 // maxAudioFrameCounter both input and output specifies how many more |
93 // AudioFrames that are allowed to be mixed. | 93 // AudioFrames that are allowed to be mixed. |
94 // rampOutList contain AudioFrames corresponding to an audio stream that | 94 // rampOutList contain AudioFrames corresponding to an audio stream that |
95 // used to be mixed but shouldn't be mixed any longer. These AudioFrames | 95 // used to be mixed but shouldn't be mixed any longer. These AudioFrames |
96 // should be ramped out over this AudioFrame to avoid audio discontinuities. | 96 // should be ramped out over this AudioFrame to avoid audio discontinuities. |
97 void UpdateToMix( | 97 void UpdateToMix( |
98 AudioFrameList* mixList, | 98 AudioFrameList* mixList, |
99 AudioFrameList* rampOutList, | 99 AudioFrameList* rampOutList, |
100 std::map<int, MixerParticipant*>* mixParticipantList, | 100 std::map<int, MixerParticipant*>* mixParticipantList, |
101 size_t& maxAudioFrameCounter); | 101 size_t* maxAudioFrameCounter) const; |
102 | 102 |
103 // Return the lowest mixing frequency that can be used without having to | 103 // Return the lowest mixing frequency that can be used without having to |
104 // downsample any audio. | 104 // downsample any audio. |
105 int32_t GetLowestMixingFrequency(); | 105 int32_t GetLowestMixingFrequency() const; |
106 int32_t GetLowestMixingFrequencyFromList(MixerParticipantList* mixList); | 106 int32_t GetLowestMixingFrequencyFromList( |
107 const MixerParticipantList* mixList) const; | |
Andrew MacDonald
2015/08/26 15:56:01
const reference
minyue-webrtc
2015/08/27 11:31:15
Done.
| |
107 | 108 |
108 // Return the AudioFrames that should be mixed anonymously. | 109 // Return the AudioFrames that should be mixed anonymously. |
109 void GetAdditionalAudio(AudioFrameList* additionalFramesList); | 110 void GetAdditionalAudio(AudioFrameList* additionalFramesList) const; |
110 | 111 |
111 // Update the MixHistory of all MixerParticipants. mixedParticipantsList | 112 // Update the MixHistory of all MixerParticipants. mixedParticipantsList |
112 // should contain a map of MixerParticipants that have been mixed. | 113 // should contain a map of MixerParticipants that have been mixed. |
113 void UpdateMixedStatus( | 114 void UpdateMixedStatus( |
114 std::map<int, MixerParticipant*>& mixedParticipantsList); | 115 const std::map<int, MixerParticipant*>& mixedParticipantsList) const; |
115 | 116 |
116 // Clears audioFrameList and reclaims all memory associated with it. | 117 // Clears audioFrameList and reclaims all memory associated with it. |
117 void ClearAudioFrameList(AudioFrameList* audioFrameList); | 118 void ClearAudioFrameList(AudioFrameList* audioFrameList) const; |
118 | 119 |
119 // Update the list of MixerParticipants who have a positive VAD. mixList | 120 // Update the list of MixerParticipants who have a positive VAD. mixList |
120 // should be a list of AudioFrames | 121 // should be a list of AudioFrames |
121 void UpdateVADPositiveParticipants( | 122 void UpdateVADPositiveParticipants(AudioFrameList* mixList) const; |
122 AudioFrameList* mixList); | |
123 | 123 |
124 // This function returns true if it finds the MixerParticipant in the | 124 // This function returns true if it finds the MixerParticipant in the |
125 // specified list of MixerParticipants. | 125 // specified list of MixerParticipants. |
126 bool IsParticipantInList( | 126 bool IsParticipantInList(const MixerParticipant& participant, |
127 MixerParticipant& participant, | 127 const MixerParticipantList* participantList) const; |
Andrew MacDonald
2015/08/26 15:56:01
const reference
minyue-webrtc
2015/08/27 11:31:15
Done.
| |
128 MixerParticipantList* participantList) const; | |
129 | 128 |
130 // Add/remove the MixerParticipant to the specified | 129 // Add/remove the MixerParticipant to the specified |
131 // MixerParticipant list. | 130 // MixerParticipant list. |
132 bool AddParticipantToList( | 131 bool AddParticipantToList( |
133 MixerParticipant& participant, | 132 MixerParticipant* participant, |
134 MixerParticipantList* participantList); | 133 MixerParticipantList* participantList) const; |
135 bool RemoveParticipantFromList( | 134 bool RemoveParticipantFromList( |
136 MixerParticipant& removeParticipant, | 135 MixerParticipant* removeParticipant, |
137 MixerParticipantList* participantList); | 136 MixerParticipantList* participantList) const; |
138 | 137 |
139 // Mix the AudioFrames stored in audioFrameList into mixedAudio. | 138 // Mix the AudioFrames stored in audioFrameList into mixedAudio. |
140 int32_t MixFromList( | 139 int32_t MixFromList(AudioFrame* mixedAudio, |
141 AudioFrame& mixedAudio, | 140 const AudioFrameList* audioFrameList) const; |
Andrew MacDonald
2015/08/26 15:56:01
const reference
minyue-webrtc
2015/08/27 11:31:15
Done.
| |
142 const AudioFrameList* audioFrameList); | 141 |
143 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No | 142 // Mix the AudioFrames stored in audioFrameList into mixedAudio. No |
144 // record will be kept of this mix (e.g. the corresponding MixerParticipants | 143 // record will be kept of this mix (e.g. the corresponding MixerParticipants |
145 // will not be marked as IsMixed() | 144 // will not be marked as IsMixed() |
146 int32_t MixAnonomouslyFromList(AudioFrame& mixedAudio, | 145 int32_t MixAnonomouslyFromList(AudioFrame* mixedAudio, |
147 const AudioFrameList* audioFrameList); | 146 const AudioFrameList* audioFrameList) const; |
Andrew MacDonald
2015/08/26 15:56:01
const reference
minyue-webrtc
2015/08/27 11:31:15
Done.
| |
148 | 147 |
149 bool LimitMixedAudio(AudioFrame& mixedAudio); | 148 bool LimitMixedAudio(AudioFrame* mixedAudio) const; |
150 | 149 |
151 rtc::scoped_ptr<CriticalSectionWrapper> _crit; | 150 rtc::scoped_ptr<CriticalSectionWrapper> _crit; |
152 rtc::scoped_ptr<CriticalSectionWrapper> _cbCrit; | 151 rtc::scoped_ptr<CriticalSectionWrapper> _cbCrit; |
153 | 152 |
154 int32_t _id; | 153 int32_t _id; |
155 | 154 |
156 Frequency _minimumMixingFreq; | 155 Frequency _minimumMixingFreq; |
157 | 156 |
158 // Mix result callback | 157 // Mix result callback |
159 AudioMixerOutputReceiver* _mixReceiver; | 158 AudioMixerOutputReceiver* _mixReceiver; |
(...skipping 23 matching lines...) Expand all Loading... | |
183 // Counter keeping track of concurrent calls to process. | 182 // Counter keeping track of concurrent calls to process. |
184 // Note: should never be higher than 1 or lower than 0. | 183 // Note: should never be higher than 1 or lower than 0. |
185 int16_t _processCalls; | 184 int16_t _processCalls; |
186 | 185 |
187 // Used for inhibiting saturation in mixing. | 186 // Used for inhibiting saturation in mixing. |
188 rtc::scoped_ptr<AudioProcessing> _limiter; | 187 rtc::scoped_ptr<AudioProcessing> _limiter; |
189 }; | 188 }; |
190 } // namespace webrtc | 189 } // namespace webrtc |
191 | 190 |
192 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_AUDIO_CONFERENCE_MIXER_IM PL_H_ | 191 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_SOURCE_AUDIO_CONFERENCE_MIXER_IM PL_H_ |
OLD | NEW |