OLD | NEW |
| (Empty) |
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_MIXER_AUDIO_MIXER_DEFINES_H_ | |
12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ | |
13 | |
14 #include <memory> | |
15 | |
16 #include "webrtc/base/checks.h" | |
17 #include "webrtc/modules/include/module_common_types.h" | |
18 #include "webrtc/typedefs.h" | |
19 | |
20 namespace webrtc { | |
21 | |
22 // A callback class that all mixer participants must inherit from/implement. | |
23 class MixerAudioSource { | |
24 public: | |
25 enum class AudioFrameInfo { | |
26 kNormal, // The samples in audio_frame are valid and should be used. | |
27 kMuted, // The samples in audio_frame should not be used, but should be | |
28 // implicitly interpreted as zero. Other fields in audio_frame | |
29 // may be read and should contain meaningful values. | |
30 kError // audio_frame will not be used. | |
31 }; | |
32 | |
33 struct AudioFrameWithMuted { | |
34 AudioFrame* audio_frame; | |
35 AudioFrameInfo audio_frame_info; | |
36 }; | |
37 | |
38 virtual ~MixerAudioSource() = default; | |
39 | |
40 // The implementation of GetAudioFrameWithMuted should update | |
41 // audio_frame with new audio every time it's called. Implementing | |
42 // classes are allowed to return the same AudioFrame pointer on | |
43 // different calls. The pointer must stay valid until the next | |
44 // mixing call or until this audio source is disconnected from the | |
45 // mixer. | |
46 virtual AudioFrameWithMuted GetAudioFrameWithMuted(int32_t id, | |
47 int sample_rate_hz) = 0; | |
48 }; | |
49 } // namespace webrtc | |
50 | |
51 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ | |
OLD | NEW |