• 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_DEFINES_H_
12 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEFINES_H_
13 
14 #include "webrtc/modules/include/module_common_types.h"
15 #include "webrtc/typedefs.h"
16 
17 namespace webrtc {
18 class MixHistory;
19 
20 // A callback class that all mixer participants must inherit from/implement.
21 class MixerParticipant
22 {
23 public:
24     // The implementation of this function should update audioFrame with new
25     // audio every time it's called.
26     //
27     // If it returns -1, the frame will not be added to the mix.
28     virtual int32_t GetAudioFrame(int32_t id,
29                                   AudioFrame* audioFrame) = 0;
30 
31     // Returns true if the participant was mixed this mix iteration.
32     bool IsMixed() const;
33 
34     // This function specifies the sampling frequency needed for the AudioFrame
35     // for future GetAudioFrame(..) calls.
36     virtual int32_t NeededFrequency(int32_t id) const = 0;
37 
38     MixHistory* _mixHistory;
39 protected:
40     MixerParticipant();
41     virtual ~MixerParticipant();
42 };
43 
44 class AudioMixerOutputReceiver
45 {
46 public:
47     // This callback function provides the mixed audio for this mix iteration.
48     // Note that uniqueAudioFrames is an array of AudioFrame pointers with the
49     // size according to the size parameter.
50     virtual void NewMixedAudio(const int32_t id,
51                                const AudioFrame& generalAudioFrame,
52                                const AudioFrame** uniqueAudioFrames,
53                                const uint32_t size) = 0;
54 protected:
AudioMixerOutputReceiver()55     AudioMixerOutputReceiver() {}
~AudioMixerOutputReceiver()56     virtual ~AudioMixerOutputReceiver() {}
57 };
58 }  // namespace webrtc
59 
60 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEFINES_H_
61