• 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_INTERFACE_AUDIO_CONFERENCE_MIXER_H_
12 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INTERFACE_AUDIO_CONFERENCE_MIXER_H_
13 
14 #include "webrtc/modules/audio_conference_mixer/interface/audio_conference_mixer_defines.h"
15 #include "webrtc/modules/interface/module.h"
16 #include "webrtc/modules/interface/module_common_types.h"
17 
18 namespace webrtc {
19 class AudioMixerOutputReceiver;
20 class AudioMixerStatusReceiver;
21 class MixerParticipant;
22 class Trace;
23 
24 class AudioConferenceMixer : public Module
25 {
26 public:
27     enum {kMaximumAmountOfMixedParticipants = 3};
28     enum Frequency
29     {
30         kNbInHz           = 8000,
31         kWbInHz           = 16000,
32         kSwbInHz          = 32000,
33         kFbInHz           = 48000,
34         kLowestPossible   = -1,
35         kDefaultFrequency = kWbInHz
36     };
37 
38     // Factory method. Constructor disabled.
39     static AudioConferenceMixer* Create(int id);
~AudioConferenceMixer()40     virtual ~AudioConferenceMixer() {}
41 
42     // Module functions
43     virtual int32_t ChangeUniqueId(const int32_t id) = 0;
44     virtual int32_t TimeUntilNextProcess() = 0 ;
45     virtual int32_t Process() = 0;
46 
47     // Register/unregister a callback class for receiving the mixed audio.
48     virtual int32_t RegisterMixedStreamCallback(
49         AudioMixerOutputReceiver& receiver) = 0;
50     virtual int32_t UnRegisterMixedStreamCallback() = 0;
51 
52     // Register/unregister a callback class for receiving status information.
53     virtual int32_t RegisterMixerStatusCallback(
54         AudioMixerStatusReceiver& mixerStatusCallback,
55         const uint32_t amountOf10MsBetweenCallbacks) = 0;
56     virtual int32_t UnRegisterMixerStatusCallback() = 0;
57 
58     // Add/remove participants as candidates for mixing.
59     virtual int32_t SetMixabilityStatus(MixerParticipant& participant,
60                                         bool mixable) = 0;
61     // mixable is set to true if a participant is a candidate for mixing.
62     virtual int32_t MixabilityStatus(MixerParticipant& participant,
63                                      bool& mixable) = 0;
64 
65     // Inform the mixer that the participant should always be mixed and not
66     // count toward the number of mixed participants. Note that a participant
67     // must have been added to the mixer (by calling SetMixabilityStatus())
68     // before this function can be successfully called.
69     virtual int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant,
70                                                  const bool mixable) = 0;
71     // mixable is set to true if the participant is mixed anonymously.
72     virtual int32_t AnonymousMixabilityStatus(MixerParticipant& participant,
73                                               bool& mixable) = 0;
74 
75     // Set the minimum sampling frequency at which to mix. The mixing algorithm
76     // may still choose to mix at a higher samling frequency to avoid
77     // downsampling of audio contributing to the mixed audio.
78     virtual int32_t SetMinimumMixingFrequency(Frequency freq) = 0;
79 
80 protected:
AudioConferenceMixer()81     AudioConferenceMixer() {}
82 };
83 }  // namespace webrtc
84 
85 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INTERFACE_AUDIO_CONFERENCE_MIXER_H_
86