Chromium Code Reviews| 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_AUDIO_MIXER_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
| 13 | 13 |
| 14 #include <map> | 14 #include <map> |
| 15 #include <memory> | 15 #include <memory> |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 #include "webrtc/base/thread_annotations.h" | |
| 18 #include "webrtc/base/thread_checker.h" | 19 #include "webrtc/base/thread_checker.h" |
| 19 #include "webrtc/engine_configurations.h" | 20 #include "webrtc/engine_configurations.h" |
| 20 #include "webrtc/modules/audio_mixer/audio_mixer.h" | 21 #include "webrtc/modules/audio_mixer/audio_mixer.h" |
| 22 #include "webrtc/modules/audio_mixer/audio_mixer_defines.h" | |
|
aleloi
2016/09/01 14:12:22
Should import things we are using and not rely on
| |
| 23 #include "webrtc/modules/audio_processing/include/audio_processing.h" | |
| 21 #include "webrtc/modules/include/module_common_types.h" | 24 #include "webrtc/modules/include/module_common_types.h" |
| 25 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | |
| 22 #include "webrtc/voice_engine/level_indicator.h" | 26 #include "webrtc/voice_engine/level_indicator.h" |
| 23 | 27 |
| 24 namespace webrtc { | 28 namespace webrtc { |
| 25 class AudioProcessing; | |
| 26 class CriticalSectionWrapper; | |
| 27 | 29 |
| 28 typedef std::vector<AudioFrame*> AudioFrameList; | 30 typedef std::vector<AudioFrame*> AudioFrameList; |
| 29 typedef std::vector<MixerAudioSource*> MixerAudioSourceList; | 31 typedef std::vector<MixerAudioSource*> MixerAudioSourceList; |
| 30 | 32 |
| 31 // Cheshire cat implementation of MixerAudioSource's non virtual functions. | |
| 32 class NewMixHistory { | |
| 33 public: | |
| 34 NewMixHistory(); | |
| 35 ~NewMixHistory(); | |
| 36 | |
| 37 // Returns true if the audio source is being mixed. | |
| 38 bool IsMixed() const; | |
| 39 | |
| 40 // Returns true if the audio source was mixed previous mix | |
| 41 // iteration. | |
| 42 bool WasMixed() const; | |
| 43 | |
| 44 // Updates the mixed status. | |
| 45 int32_t SetIsMixed(bool mixed); | |
| 46 | |
| 47 void ResetMixedStatus(); | |
| 48 | |
| 49 private: | |
| 50 bool is_mixed_; | |
| 51 }; | |
| 52 | |
| 53 class AudioMixerImpl : public AudioMixer { | 33 class AudioMixerImpl : public AudioMixer { |
| 54 public: | 34 public: |
| 55 // AudioProcessing only accepts 10 ms frames. | 35 // AudioProcessing only accepts 10 ms frames. |
| 56 static const int kFrameDurationInMs = 10; | 36 static const int kFrameDurationInMs = 10; |
| 57 | 37 |
| 58 explicit AudioMixerImpl(int id); | 38 explicit AudioMixerImpl(int id); |
| 59 | 39 |
| 60 ~AudioMixerImpl() override; | 40 ~AudioMixerImpl() override; |
| 61 | 41 |
| 62 // Must be called after ctor. | 42 // Must be called after ctor. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 bool AddAudioSourceToList(MixerAudioSource* audio_source, | 78 bool AddAudioSourceToList(MixerAudioSource* audio_source, |
| 99 MixerAudioSourceList* audio_source_list) const; | 79 MixerAudioSourceList* audio_source_list) const; |
| 100 bool RemoveAudioSourceFromList(MixerAudioSource* remove_audio_source, | 80 bool RemoveAudioSourceFromList(MixerAudioSource* remove_audio_source, |
| 101 MixerAudioSourceList* audio_source_list) const; | 81 MixerAudioSourceList* audio_source_list) const; |
| 102 | 82 |
| 103 // Mix the AudioFrames stored in audioFrameList into mixed_audio. | 83 // Mix the AudioFrames stored in audioFrameList into mixed_audio. |
| 104 static int32_t MixFromList(AudioFrame* mixed_audio, | 84 static int32_t MixFromList(AudioFrame* mixed_audio, |
| 105 const AudioFrameList& audio_frame_list, | 85 const AudioFrameList& audio_frame_list, |
| 106 int32_t id, | 86 int32_t id, |
| 107 bool use_limiter); | 87 bool use_limiter); |
| 108 | 88 |
|
aleloi
2016/09/01 14:12:22
Static member changed to non-member in .cc file (i
| |
| 109 bool LimitMixedAudio(AudioFrame* mixed_audio) const; | 89 bool LimitMixedAudio(AudioFrame* mixed_audio) const; |
| 110 | 90 |
| 111 // Output level functions for VoEVolumeControl. | 91 // Output level functions for VoEVolumeControl. |
| 112 int GetOutputAudioLevel() override; | 92 int GetOutputAudioLevel() override; |
| 113 | 93 |
| 114 int GetOutputAudioLevelFullRange() override; | 94 int GetOutputAudioLevelFullRange() override; |
| 115 | 95 |
| 116 std::unique_ptr<CriticalSectionWrapper> crit_; | 96 std::unique_ptr<CriticalSectionWrapper> crit_; |
| 117 | 97 |
| 118 const int32_t id_; | 98 const int32_t id_; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 141 std::unique_ptr<AudioProcessing> limiter_; | 121 std::unique_ptr<AudioProcessing> limiter_; |
| 142 | 122 |
| 143 // Measures audio level for the combined signal. | 123 // Measures audio level for the combined signal. |
| 144 voe::AudioLevel audio_level_ ACCESS_ON(&thread_checker_); | 124 voe::AudioLevel audio_level_ ACCESS_ON(&thread_checker_); |
| 145 | 125 |
| 146 RTC_DISALLOW_COPY_AND_ASSIGN(AudioMixerImpl); | 126 RTC_DISALLOW_COPY_AND_ASSIGN(AudioMixerImpl); |
| 147 }; | 127 }; |
| 148 } // namespace webrtc | 128 } // namespace webrtc |
| 149 | 129 |
| 150 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ | 130 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
| OLD | NEW |