• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_H_
12 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_H_
13 
14 #include "webrtc/modules/audio_conference_mixer/include/audio_conference_mixer_defines.h"
15 #include "webrtc/modules/include/module.h"
16 #include "webrtc/modules/include/module_common_types.h"
17 
18 namespace webrtc {
19 class AudioMixerOutputReceiver;
20 class MixerParticipant;
21 class Trace;
22 
23 class AudioConferenceMixer : public Module
24 {
25 public:
26     enum {kMaximumAmountOfMixedParticipants = 3};
27     enum Frequency
28     {
29         kNbInHz           = 8000,
30         kWbInHz           = 16000,
31         kSwbInHz          = 32000,
32         kFbInHz           = 48000,
33         kLowestPossible   = -1,
34         kDefaultFrequency = kWbInHz
35     };
36 
37     // Factory method. Constructor disabled.
38     static AudioConferenceMixer* Create(int id);
~AudioConferenceMixer()39     virtual ~AudioConferenceMixer() {}
40 
41     // Module functions
42     int64_t TimeUntilNextProcess() override = 0;
43     int32_t Process() override = 0;
44 
45     // Register/unregister a callback class for receiving the mixed audio.
46     virtual int32_t RegisterMixedStreamCallback(
47         AudioMixerOutputReceiver* receiver) = 0;
48     virtual int32_t UnRegisterMixedStreamCallback() = 0;
49 
50     // Add/remove participants as candidates for mixing.
51     virtual int32_t SetMixabilityStatus(MixerParticipant* participant,
52                                         bool mixable) = 0;
53     // Returns true if a participant is a candidate for mixing.
54     virtual bool MixabilityStatus(
55         const MixerParticipant& participant) const = 0;
56 
57     // Inform the mixer that the participant should always be mixed and not
58     // count toward the number of mixed participants. Note that a participant
59     // must have been added to the mixer (by calling SetMixabilityStatus())
60     // before this function can be successfully called.
61     virtual int32_t SetAnonymousMixabilityStatus(
62         MixerParticipant* participant, bool mixable) = 0;
63     // Returns true if the participant is mixed anonymously.
64     virtual bool AnonymousMixabilityStatus(
65         const MixerParticipant& participant) const = 0;
66 
67     // Set the minimum sampling frequency at which to mix. The mixing algorithm
68     // may still choose to mix at a higher samling frequency to avoid
69     // downsampling of audio contributing to the mixed audio.
70     virtual int32_t SetMinimumMixingFrequency(Frequency freq) = 0;
71 
72 protected:
AudioConferenceMixer()73     AudioConferenceMixer() {}
74 };
75 }  // namespace webrtc
76 
77 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_H_
78