| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Set/get mix frequency | 77 // Set/get mix frequency |
| 78 int32_t SetOutputFrequency(const Frequency& frequency); | 78 int32_t SetOutputFrequency(const Frequency& frequency); |
| 79 Frequency OutputFrequency() const; | 79 Frequency OutputFrequency() const; |
| 80 | 80 |
| 81 // Compute what audio sources to mix from audio_source_list_. Ramp | 81 // Compute what audio sources to mix from audio_source_list_. Ramp |
| 82 // in and out. Update mixed status. Mixes up to | 82 // in and out. Update mixed status. Mixes up to |
| 83 // kMaximumAmountOfMixedAudioSources audio sources. | 83 // kMaximumAmountOfMixedAudioSources audio sources. |
| 84 AudioFrameList GetNonAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_); | 84 AudioFrameList GetNonAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 85 | 85 |
| 86 // Return the lowest mixing frequency that can be used without having to | |
| 87 // downsample any audio. | |
| 88 int32_t GetLowestMixingFrequency() const; | |
| 89 int32_t GetLowestMixingFrequencyFromList( | |
| 90 const MixerAudioSourceList& mixList) const; | |
| 91 | |
| 92 // Return the AudioFrames that should be mixed anonymously. Ramp in | 86 // Return the AudioFrames that should be mixed anonymously. Ramp in |
| 93 // and out. Update mixed status. | 87 // and out. Update mixed status. |
| 94 AudioFrameList GetAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_); | 88 AudioFrameList GetAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_); |
| 95 | 89 |
| 96 // This function returns true if it finds the MixerAudioSource in the | 90 // This function returns true if it finds the MixerAudioSource in the |
| 97 // specified list of MixerAudioSources. | 91 // specified list of MixerAudioSources. |
| 98 bool IsAudioSourceInList(const MixerAudioSource& audio_source, | 92 bool IsAudioSourceInList(const MixerAudioSource& audio_source, |
| 99 const MixerAudioSourceList& audioSourceList) const; | 93 const MixerAudioSourceList& audio_source_list) const; |
| 100 | 94 |
| 101 // Add/remove the MixerAudioSource to the specified | 95 // Add/remove the MixerAudioSource to the specified |
| 102 // MixerAudioSource list. | 96 // MixerAudioSource list. |
| 103 bool AddAudioSourceToList(MixerAudioSource* audio_source, | 97 bool AddAudioSourceToList(MixerAudioSource* audio_source, |
| 104 MixerAudioSourceList* audioSourceList) const; | 98 MixerAudioSourceList* audio_source_list) const; |
| 105 bool RemoveAudioSourceFromList(MixerAudioSource* removeAudioSource, | 99 bool RemoveAudioSourceFromList(MixerAudioSource* remove_audio_source, |
| 106 MixerAudioSourceList* audioSourceList) const; | 100 MixerAudioSourceList* audio_source_list) const; |
| 107 | 101 |
| 108 // Mix the AudioFrames stored in audioFrameList into mixedAudio. | 102 // Mix the AudioFrames stored in audioFrameList into mixed_audio. |
| 109 static int32_t MixFromList(AudioFrame* mixedAudio, | 103 static int32_t MixFromList(AudioFrame* mixed_audio, |
| 110 const AudioFrameList& audioFrameList, | 104 const AudioFrameList& audio_frame_list, |
| 111 int32_t id, | 105 int32_t id, |
| 112 bool use_limiter); | 106 bool use_limiter); |
| 113 | 107 |
| 114 bool LimitMixedAudio(AudioFrame* mixedAudio) const; | 108 bool LimitMixedAudio(AudioFrame* mixed_audio) const; |
| 115 | 109 |
| 116 // Output level functions for VoEVolumeControl. | 110 // Output level functions for VoEVolumeControl. |
| 117 int GetOutputAudioLevel() override; | 111 int GetOutputAudioLevel() override; |
| 118 | 112 |
| 119 int GetOutputAudioLevelFullRange() override; | 113 int GetOutputAudioLevelFullRange() override; |
| 120 | 114 |
| 121 rtc::CriticalSection crit_; | 115 rtc::CriticalSection crit_; |
| 122 | 116 |
| 123 const int32_t id_; | 117 const int32_t id_; |
| 124 | 118 |
| 125 // The current sample frequency and sample size when mixing. | 119 // The current sample frequency and sample size when mixing. |
| 126 Frequency output_frequency_ ACCESS_ON(&thread_checker_); | 120 Frequency output_frequency_ ACCESS_ON(&thread_checker_); |
| 127 size_t sample_size_ ACCESS_ON(&thread_checker_); | 121 size_t sample_size_ ACCESS_ON(&thread_checker_); |
| 128 | 122 |
| 129 // List of all audio sources. Note all lists are disjunct | 123 // List of all audio sources. Note all lists are disjunct |
| 130 MixerAudioSourceList audio_source_list_ GUARDED_BY(crit_); // May be mixed. | 124 MixerAudioSourceList audio_source_list_ GUARDED_BY(crit_); // May be mixed. |
| 131 | 125 |
| 132 // Always mixed, anonomously. | 126 // Always mixed, anonymously. |
| 133 MixerAudioSourceList additional_audio_source_list_ GUARDED_BY(crit_); | 127 MixerAudioSourceList additional_audio_source_list_ GUARDED_BY(crit_); |
| 134 | 128 |
| 135 size_t num_mixed_audio_sources_ GUARDED_BY(crit_); | 129 size_t num_mixed_audio_sources_ GUARDED_BY(crit_); |
| 136 // Determines if we will use a limiter for clipping protection during | 130 // Determines if we will use a limiter for clipping protection during |
| 137 // mixing. | 131 // mixing. |
| 138 bool use_limiter_ ACCESS_ON(&thread_checker_); | 132 bool use_limiter_ ACCESS_ON(&thread_checker_); |
| 139 | 133 |
| 140 uint32_t time_stamp_ ACCESS_ON(&thread_checker_); | 134 uint32_t time_stamp_ ACCESS_ON(&thread_checker_); |
| 141 | 135 |
| 142 // Ensures that Mix is called from the same thread. | 136 // Ensures that Mix is called from the same thread. |
| 143 rtc::ThreadChecker thread_checker_; | 137 rtc::ThreadChecker thread_checker_; |
| 144 | 138 |
| 145 // Used for inhibiting saturation in mixing. | 139 // Used for inhibiting saturation in mixing. |
| 146 std::unique_ptr<AudioProcessing> limiter_ ACCESS_ON(&thread_checker_); | 140 std::unique_ptr<AudioProcessing> limiter_ ACCESS_ON(&thread_checker_); |
| 147 | 141 |
| 148 // Measures audio level for the combined signal. | 142 // Measures audio level for the combined signal. |
| 149 voe::AudioLevel audio_level_ ACCESS_ON(&thread_checker_); | 143 voe::AudioLevel audio_level_ ACCESS_ON(&thread_checker_); |
| 144 |
| 145 RTC_DISALLOW_COPY_AND_ASSIGN(AudioMixerImpl); |
| 150 }; | 146 }; |
| 151 } // namespace webrtc | 147 } // namespace webrtc |
| 152 | 148 |
| 153 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ | 149 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
| OLD | NEW |