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