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 <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/api/audio/audio_mixer.h" | 17 #include "webrtc/api/audio/audio_mixer.h" |
18 #include "webrtc/base/scoped_ref_ptr.h" | 18 #include "webrtc/base/scoped_ref_ptr.h" |
19 #include "webrtc/base/thread_annotations.h" | 19 #include "webrtc/base/thread_annotations.h" |
20 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/race_checker.h" |
21 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 21 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
22 #include "webrtc/modules/include/module_common_types.h" | 22 #include "webrtc/modules/include/module_common_types.h" |
23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" | 23 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" |
24 #include "webrtc/voice_engine_configurations.h" | 24 #include "webrtc/voice_engine_configurations.h" |
25 | 25 |
26 namespace webrtc { | 26 namespace webrtc { |
27 | 27 |
28 typedef std::vector<AudioFrame*> AudioFrameList; | 28 typedef std::vector<AudioFrame*> AudioFrameList; |
29 | 29 |
30 class AudioMixerImpl : public AudioMixer { | 30 class AudioMixerImpl : public AudioMixer { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 SourceStatusList* audio_source_list) const; | 83 SourceStatusList* audio_source_list) const; |
84 bool RemoveAudioSourceFromList(Source* remove_audio_source, | 84 bool RemoveAudioSourceFromList(Source* remove_audio_source, |
85 SourceStatusList* audio_source_list) const; | 85 SourceStatusList* audio_source_list) const; |
86 | 86 |
87 bool LimitMixedAudio(AudioFrame* mixed_audio) const; | 87 bool LimitMixedAudio(AudioFrame* mixed_audio) const; |
88 | 88 |
89 | 89 |
90 rtc::CriticalSection crit_; | 90 rtc::CriticalSection crit_; |
91 | 91 |
92 // The current sample frequency and sample size when mixing. | 92 // The current sample frequency and sample size when mixing. |
93 int output_frequency_ ACCESS_ON(&thread_checker_); | 93 int output_frequency_ GUARDED_BY(&race_checker_); |
kwiberg-webrtc
2016/10/20 09:37:14
Is the & necessary?
aleloi
2016/10/20 09:52:01
Turns out it isn't. I've removed it.
I looked in
kwiberg-webrtc
2016/10/20 10:47:13
👍
| |
94 size_t sample_size_ ACCESS_ON(&thread_checker_); | 94 size_t sample_size_ GUARDED_BY(&race_checker_); |
95 | 95 |
96 // List of all audio sources. Note all lists are disjunct | 96 // List of all audio sources. Note all lists are disjunct |
97 SourceStatusList audio_source_list_ GUARDED_BY(crit_); // May be mixed. | 97 SourceStatusList audio_source_list_ GUARDED_BY(crit_); // May be mixed. |
98 | 98 |
99 // Determines if we will use a limiter for clipping protection during | 99 // Determines if we will use a limiter for clipping protection during |
100 // mixing. | 100 // mixing. |
101 bool use_limiter_ ACCESS_ON(&thread_checker_); | 101 bool use_limiter_ GUARDED_BY(&race_checker_); |
102 | 102 |
103 uint32_t time_stamp_ ACCESS_ON(&thread_checker_); | 103 uint32_t time_stamp_ GUARDED_BY(&race_checker_); |
104 | 104 |
105 // Ensures that Mix is called from the same thread. | 105 // Checks that Mix is called sequentially. |
aleloi
2016/10/20 09:24:23
We cannot *ensure* at compile time, because (if I
| |
106 rtc::ThreadChecker thread_checker_; | 106 rtc::RaceChecker race_checker_; |
kwiberg-webrtc
2016/10/20 09:37:14
I would move this up to where crit_ is defined, an
aleloi
2016/10/20 09:52:01
Moved up and reworded comment.
kwiberg-webrtc
2016/10/20 10:47:13
Excellent.
| |
107 | 107 |
108 // Used for inhibiting saturation in mixing. | 108 // Used for inhibiting saturation in mixing. |
109 std::unique_ptr<AudioProcessing> limiter_ ACCESS_ON(&thread_checker_); | 109 std::unique_ptr<AudioProcessing> limiter_ GUARDED_BY(&race_checker_); |
110 | 110 |
111 RTC_DISALLOW_COPY_AND_ASSIGN(AudioMixerImpl); | 111 RTC_DISALLOW_COPY_AND_ASSIGN(AudioMixerImpl); |
112 }; | 112 }; |
113 } // namespace webrtc | 113 } // namespace webrtc |
114 | 114 |
115 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ | 115 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_IMPL_H_ |
OLD | NEW |