OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ |
12 #define WEBRTC_MODULES_AUDIO_MIXER_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ | 12 #define WEBRTC_MODULES_AUDIO_MIXER_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ |
13 | 13 |
14 #include "webrtc/modules/audio_mixer/include/audio_mixer_defines.h" | 14 #include "webrtc/modules/audio_mixer/include/audio_mixer_defines.h" |
15 #include "webrtc/modules/include/module.h" | 15 #include "webrtc/modules/include/module.h" |
16 #include "webrtc/modules/include/module_common_types.h" | 16 #include "webrtc/modules/include/module_common_types.h" |
17 | 17 |
18 namespace webrtc { | 18 namespace webrtc { |
19 class MixerAudioSource; | 19 class MixerAudioSource; |
20 | 20 |
21 class NewAudioConferenceMixer : public Module { | 21 class NewAudioConferenceMixer { |
22 public: | 22 public: |
23 enum { kMaximumAmountOfMixedAudioSources = 3 }; | 23 enum { kMaximumAmountOfMixedAudioSources = 3 }; |
24 enum Frequency { | 24 enum Frequency { |
25 kNbInHz = 8000, | 25 kNbInHz = 8000, |
26 kWbInHz = 16000, | 26 kWbInHz = 16000, |
27 kSwbInHz = 32000, | 27 kSwbInHz = 32000, |
28 kFbInHz = 48000, | 28 kFbInHz = 48000, |
29 kLowestPossible = -1, | 29 kLowestPossible = -1, |
30 kDefaultFrequency = kWbInHz | 30 kDefaultFrequency = kWbInHz |
31 }; | 31 }; |
32 | 32 |
33 // Factory method. Constructor disabled. | 33 // Factory method. Constructor disabled. |
34 static NewAudioConferenceMixer* Create(int id); | 34 static NewAudioConferenceMixer* Create(int id); |
35 virtual ~NewAudioConferenceMixer() {} | 35 virtual ~NewAudioConferenceMixer() {} |
36 | 36 |
37 // Module functions | |
38 int64_t TimeUntilNextProcess() override = 0; | |
39 void Process() override = 0; | |
40 | |
41 // Add/remove audio sources as candidates for mixing. | 37 // Add/remove audio sources as candidates for mixing. |
42 virtual int32_t SetMixabilityStatus(MixerAudioSource* audio_source, | 38 virtual int32_t SetMixabilityStatus(MixerAudioSource* audio_source, |
43 bool mixable) = 0; | 39 bool mixable) = 0; |
44 // Returns true if an audio source is a candidate for mixing. | 40 // Returns true if an audio source is a candidate for mixing. |
45 virtual bool MixabilityStatus(const MixerAudioSource& audio_source) const = 0; | 41 virtual bool MixabilityStatus(const MixerAudioSource& audio_source) const = 0; |
46 | 42 |
47 // Inform the mixer that the audio source should always be mixed and not | 43 // Inform the mixer that the audio source should always be mixed and not |
48 // count toward the number of mixed audio sources. Note that an audio source | 44 // count toward the number of mixed audio sources. Note that an audio source |
49 // must have been added to the mixer (by calling SetMixabilityStatus()) | 45 // must have been added to the mixer (by calling SetMixabilityStatus()) |
50 // before this function can be successfully called. | 46 // before this function can be successfully called. |
51 virtual int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, | 47 virtual int32_t SetAnonymousMixabilityStatus(MixerAudioSource* audio_source, |
52 bool mixable) = 0; | 48 bool mixable) = 0; |
53 | 49 |
54 // Performs mixing by asking registered audio sources for audio. | 50 // Performs mixing by asking registered audio sources for audio. The |
55 // The mixed result is placed in the provided AudioFrame. | 51 // mixed result is placed in the provided AudioFrame. Can only be |
| 52 // called from a single thread. |
56 virtual void Mix(AudioFrame* audio_frame_for_mixing) = 0; | 53 virtual void Mix(AudioFrame* audio_frame_for_mixing) = 0; |
57 | 54 |
58 // Set the minimum sampling frequency at which to mix. The mixing algorithm | 55 // Set the minimum sampling frequency at which to mix. The mixing algorithm |
59 // may still choose to mix at a higher samling frequency to avoid | 56 // may still choose to mix at a higher samling frequency to avoid |
60 // downsampling of audio contributing to the mixed audio. | 57 // downsampling of audio contributing to the mixed audio. |
61 virtual int32_t SetMinimumMixingFrequency(Frequency freq) = 0; | 58 virtual int32_t SetMinimumMixingFrequency(Frequency freq) = 0; |
62 | 59 |
63 // Returns true if the audio source is mixed anonymously. | 60 // Returns true if the audio source is mixed anonymously. |
64 virtual bool AnonymousMixabilityStatus( | 61 virtual bool AnonymousMixabilityStatus( |
65 const MixerAudioSource& audio_source) const = 0; | 62 const MixerAudioSource& audio_source) const = 0; |
66 | 63 |
67 protected: | 64 protected: |
68 NewAudioConferenceMixer() {} | 65 NewAudioConferenceMixer() {} |
69 }; | 66 }; |
70 } // namespace webrtc | 67 } // namespace webrtc |
71 | 68 |
72 #endif // WEBRTC_MODULES_AUDIO_MIXER_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ | 69 #endif // WEBRTC_MODULES_AUDIO_MIXER_INCLUDE_NEW_AUDIO_CONFERENCE_MIXER_H_ |
OLD | NEW |