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_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEF
INES_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEF
INES_H_ |
12 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEF
INES_H_ | 12 #define WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_DEF
INES_H_ |
13 | 13 |
| 14 #include "webrtc/base/checks.h" |
14 #include "webrtc/modules/include/module_common_types.h" | 15 #include "webrtc/modules/include/module_common_types.h" |
15 #include "webrtc/typedefs.h" | 16 #include "webrtc/typedefs.h" |
16 | 17 |
17 namespace webrtc { | 18 namespace webrtc { |
18 class MixHistory; | 19 class MixHistory; |
19 | 20 |
20 // A callback class that all mixer participants must inherit from/implement. | 21 // A callback class that all mixer participants must inherit from/implement. |
21 class MixerParticipant | 22 class MixerParticipant |
22 { | 23 { |
23 public: | 24 public: |
24 // The implementation of this function should update audioFrame with new | 25 // The implementation of this function should update audioFrame with new |
25 // audio every time it's called. | 26 // audio every time it's called. |
26 // | 27 // |
27 // If it returns -1, the frame will not be added to the mix. | 28 // If it returns -1, the frame will not be added to the mix. |
| 29 // |
| 30 // NOTE: This function should not be called. It will remain for a short |
| 31 // time so that subclasses can override it without getting warnings. |
| 32 // TODO(henrik.lundin) Remove this function. |
28 virtual int32_t GetAudioFrame(int32_t id, | 33 virtual int32_t GetAudioFrame(int32_t id, |
29 AudioFrame* audioFrame) = 0; | 34 AudioFrame* audioFrame) { |
| 35 RTC_CHECK(false); |
| 36 return -1; |
| 37 } |
| 38 |
| 39 |
| 40 // The implementation of GetAudioFrameWithMuted should update audio_frame |
| 41 // with new audio every time it's called. The return value will be |
| 42 // interpreted as follows. |
| 43 enum class AudioFrameInfo { |
| 44 kNormal, // The samples in audio_frame are valid and should be used. |
| 45 kMuted, // The samples in audio_frame should not be used, but should be |
| 46 // implicitly interpreted as zero. Other fields in audio_frame |
| 47 // may be read and should contain meaningful values. |
| 48 kError // audio_frame will not be used. |
| 49 }; |
| 50 |
| 51 virtual AudioFrameInfo GetAudioFrameWithMuted(int32_t id, |
| 52 AudioFrame* audio_frame) { |
| 53 return GetAudioFrame(id, audio_frame) == -1 ? |
| 54 AudioFrameInfo::kError : |
| 55 AudioFrameInfo::kNormal; |
| 56 } |
30 | 57 |
31 // Returns true if the participant was mixed this mix iteration. | 58 // Returns true if the participant was mixed this mix iteration. |
32 bool IsMixed() const; | 59 bool IsMixed() const; |
33 | 60 |
34 // This function specifies the sampling frequency needed for the AudioFrame | 61 // This function specifies the sampling frequency needed for the AudioFrame |
35 // for future GetAudioFrame(..) calls. | 62 // for future GetAudioFrame(..) calls. |
36 virtual int32_t NeededFrequency(int32_t id) const = 0; | 63 virtual int32_t NeededFrequency(int32_t id) const = 0; |
37 | 64 |
38 MixHistory* _mixHistory; | 65 MixHistory* _mixHistory; |
39 protected: | 66 protected: |
(...skipping 11 matching lines...) Expand all Loading... |
51 const AudioFrame& generalAudioFrame, | 78 const AudioFrame& generalAudioFrame, |
52 const AudioFrame** uniqueAudioFrames, | 79 const AudioFrame** uniqueAudioFrames, |
53 const uint32_t size) = 0; | 80 const uint32_t size) = 0; |
54 protected: | 81 protected: |
55 AudioMixerOutputReceiver() {} | 82 AudioMixerOutputReceiver() {} |
56 virtual ~AudioMixerOutputReceiver() {} | 83 virtual ~AudioMixerOutputReceiver() {} |
57 }; | 84 }; |
58 } // namespace webrtc | 85 } // namespace webrtc |
59 | 86 |
60 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_D
EFINES_H_ | 87 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_D
EFINES_H_ |
OLD | NEW |