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: |
25 enum class AudioFrameInfo { | |
26 kUnmuted, | |
minyue-webrtc
2016/05/17 14:59:16
Maybe kNormal is better than kUnmuted
hlundin-webrtc
2016/05/17 19:57:51
Done.
| |
27 kMuted, | |
28 kError | |
29 }; | |
30 | |
24 // The implementation of this function should update audioFrame with new | 31 // The implementation of this function should update audioFrame with new |
25 // audio every time it's called. | 32 // audio every time it's called. |
26 // | 33 // |
27 // If it returns -1, the frame will not be added to the mix. | 34 // If it returns -1, the frame will not be added to the mix. |
28 virtual int32_t GetAudioFrame(int32_t id, | 35 virtual int32_t GetAudioFrame(int32_t id, |
29 AudioFrame* audioFrame) = 0; | 36 AudioFrame* audioFrame) { |
37 RTC_CHECK(false); | |
kwiberg-webrtc
2016/05/17 12:57:06
Add a comment such as
// This function should n
minyue-webrtc
2016/05/17 14:59:16
1. maybe DCHECK?
2. should still have a "return"
hlundin-webrtc
2016/05/17 19:57:51
Done.
hlundin-webrtc
2016/05/17 19:57:51
I followed kwiberg's recommendation to use RTC_CHE
kwiberg-webrtc
2016/05/18 02:45:06
This line should never be reached, so there's no r
| |
38 } | |
39 | |
40 // The implementation of this function should update audio_frame with new | |
41 // audio every time it's called. The return value should will be interpreted | |
42 // as follows. | |
kwiberg-webrtc
2016/05/17 12:57:06
Grammar.
hlundin-webrtc
2016/05/17 19:57:51
Done.
| |
43 // - kUnmuted: the samples in audio_frame are valid and will be used. | |
44 // - kMuted: the samples in audio_frame will not be read, but will be | |
minyue-webrtc
2016/05/17 14:59:16
"will not be read" or "will not be overwritten"?
hlundin-webrtc
2016/05/17 19:57:51
"will not be read". This is the definition of a ca
kwiberg-webrtc
2016/05/18 02:45:06
It may be better to say "valid and should be used"
minyue-webrtc
2016/05/18 02:53:51
+1
hlundin-webrtc
2016/05/18 06:58:53
Done.
| |
45 // implicitly interpreted as zero. Other fields in audio_frame | |
46 // may be read and should contain meaningful values. | |
47 // - kError: audio_frame will not be used. | |
kwiberg-webrtc
2016/05/17 12:57:06
To avoid having to keep comments and enum in sync,
hlundin-webrtc
2016/05/17 19:57:51
Style guide says no. But I did it anyway, since we
| |
48 virtual AudioFrameInfo GetAudioFrameWithMuted(int32_t id, | |
49 AudioFrame* audio_frame) { | |
50 return GetAudioFrame(id, audio_frame) != 0 ? | |
minyue-webrtc
2016/05/17 14:59:16
"!=0" => "== -1" from what is written at line 34
hlundin-webrtc
2016/05/17 19:57:51
Done.
| |
51 AudioFrameInfo::kError : | |
52 AudioFrameInfo::kUnmuted; | |
53 } | |
30 | 54 |
31 // Returns true if the participant was mixed this mix iteration. | 55 // Returns true if the participant was mixed this mix iteration. |
32 bool IsMixed() const; | 56 bool IsMixed() const; |
33 | 57 |
34 // This function specifies the sampling frequency needed for the AudioFrame | 58 // This function specifies the sampling frequency needed for the AudioFrame |
35 // for future GetAudioFrame(..) calls. | 59 // for future GetAudioFrame(..) calls. |
36 virtual int32_t NeededFrequency(int32_t id) const = 0; | 60 virtual int32_t NeededFrequency(int32_t id) const = 0; |
37 | 61 |
38 MixHistory* _mixHistory; | 62 MixHistory* _mixHistory; |
39 protected: | 63 protected: |
(...skipping 11 matching lines...) Expand all Loading... | |
51 const AudioFrame& generalAudioFrame, | 75 const AudioFrame& generalAudioFrame, |
52 const AudioFrame** uniqueAudioFrames, | 76 const AudioFrame** uniqueAudioFrames, |
53 const uint32_t size) = 0; | 77 const uint32_t size) = 0; |
54 protected: | 78 protected: |
55 AudioMixerOutputReceiver() {} | 79 AudioMixerOutputReceiver() {} |
56 virtual ~AudioMixerOutputReceiver() {} | 80 virtual ~AudioMixerOutputReceiver() {} |
57 }; | 81 }; |
58 } // namespace webrtc | 82 } // namespace webrtc |
59 | 83 |
60 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_D EFINES_H_ | 84 #endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_INCLUDE_AUDIO_CONFERENCE_MIXER_D EFINES_H_ |
OLD | NEW |