| 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 |
| 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_ |
| 13 | 13 |
| 14 #include <list> | 14 #include <list> |
| 15 #include <map> | 15 #include <map> |
| 16 #include <memory> | 16 #include <memory> |
| 17 | 17 |
| 18 #include "webrtc/base/thread_checker.h" |
| 18 #include "webrtc/engine_configurations.h" | 19 #include "webrtc/engine_configurations.h" |
| 19 #include "webrtc/modules/audio_mixer/include/new_audio_conference_mixer.h" | 20 #include "webrtc/modules/audio_mixer/include/new_audio_conference_mixer.h" |
| 20 #include "webrtc/modules/audio_conference_mixer/source/memory_pool.h" | 21 #include "webrtc/modules/audio_conference_mixer/source/memory_pool.h" |
| 21 #include "webrtc/modules/audio_conference_mixer/source/time_scheduler.h" | |
| 22 #include "webrtc/modules/include/module_common_types.h" | 22 #include "webrtc/modules/include/module_common_types.h" |
| 23 | 23 |
| 24 namespace webrtc { | 24 namespace webrtc { |
| 25 class AudioProcessing; | 25 class AudioProcessing; |
| 26 class CriticalSectionWrapper; | 26 class CriticalSectionWrapper; |
| 27 | 27 |
| 28 struct FrameAndMuteInfo { | 28 struct FrameAndMuteInfo { |
| 29 FrameAndMuteInfo(AudioFrame* f, bool m) : frame(f), muted(m) {} | 29 FrameAndMuteInfo(AudioFrame* f, bool m) : frame(f), muted(m) {} |
| 30 AudioFrame* frame; | 30 AudioFrame* frame; |
| 31 bool muted; | 31 bool muted; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 60 public: | 60 public: |
| 61 // AudioProcessing only accepts 10 ms frames. | 61 // AudioProcessing only accepts 10 ms frames. |
| 62 enum { kProcessPeriodicityInMs = 10 }; | 62 enum { kProcessPeriodicityInMs = 10 }; |
| 63 | 63 |
| 64 explicit NewAudioConferenceMixerImpl(int id); | 64 explicit NewAudioConferenceMixerImpl(int id); |
| 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 | |
| 71 int64_t TimeUntilNextProcess() override; | |
| 72 void Process() override; | |
| 73 | |
| 74 // NewAudioConferenceMixer functions | 70 // NewAudioConferenceMixer functions |
| 75 int32_t SetMixabilityStatus(MixerAudioSource* audio_source, | 71 int32_t SetMixabilityStatus(MixerAudioSource* audio_source, |
| 76 bool mixable) override; | 72 bool mixable) override; |
| 77 bool MixabilityStatus(const MixerAudioSource& audio_source) const override; | 73 bool MixabilityStatus(const MixerAudioSource& audio_source) const override; |
| 78 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, | 74 int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, |
| 79 bool mixable) override; | 75 bool mixable) override; |
| 80 void Mix(AudioFrame* audio_frame_for_mixing) override; | 76 void Mix(AudioFrame* audio_frame_for_mixing) override; |
| 81 int32_t SetMinimumMixingFrequency(Frequency freq) override; | 77 int32_t SetMinimumMixingFrequency(Frequency freq) override; |
| 82 bool AnonymousMixabilityStatus( | 78 bool AnonymousMixabilityStatus( |
| 83 const MixerAudioSource& audio_source) const override; | 79 const MixerAudioSource& audio_source) const override; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Always mixed, anonomously. | 159 // Always mixed, anonomously. |
| 164 MixerAudioSourceList additional_audio_source_list_; | 160 MixerAudioSourceList additional_audio_source_list_; |
| 165 | 161 |
| 166 size_t num_mixed_audio_sources_; | 162 size_t num_mixed_audio_sources_; |
| 167 // Determines if we will use a limiter for clipping protection during | 163 // Determines if we will use a limiter for clipping protection during |
| 168 // mixing. | 164 // mixing. |
| 169 bool use_limiter_; | 165 bool use_limiter_; |
| 170 | 166 |
| 171 uint32_t _timeStamp; | 167 uint32_t _timeStamp; |
| 172 | 168 |
| 173 // Metronome class. | 169 // Ensures that Mix is called from the same thread. |
| 174 TimeScheduler _timeScheduler; | 170 rtc::ThreadChecker thread_checker_; |
| 175 | |
| 176 // Counter keeping track of concurrent calls to process. | |
| 177 // Note: should never be higher than 1 or lower than 0. | |
| 178 int16_t _processCalls; | |
| 179 | 171 |
| 180 // Used for inhibiting saturation in mixing. | 172 // Used for inhibiting saturation in mixing. |
| 181 std::unique_ptr<AudioProcessing> _limiter; | 173 std::unique_ptr<AudioProcessing> _limiter; |
| 182 }; | 174 }; |
| 183 } // namespace webrtc | 175 } // namespace webrtc |
| 184 | 176 |
| 185 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ | 177 #endif // WEBRTC_MODULES_AUDIO_MIXER_SOURCE_NEW_AUDIO_CONFERENCE_MIXER_IMPL_H_ |
| OLD | NEW |