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 // !!!: Remove this file. "_defines" sounds to me like it would either be |
| 12 // #define constants/macros, or other constants, but it is not. It defines a |
| 13 // mixer source. Confusing. |
11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ | 14 #ifndef WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ |
12 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ | 15 #define WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ |
13 | 16 |
14 #include <memory> | 17 #include <memory> |
15 | 18 |
16 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
17 #include "webrtc/modules/include/module_common_types.h" | 20 #include "webrtc/modules/include/module_common_types.h" |
18 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
19 | 22 |
20 namespace webrtc { | 23 namespace webrtc { |
21 | 24 |
| 25 // !!!: Move into audio_mixer.h, rename it AudioMixerSource and make it a |
| 26 // pure interface. |
| 27 |
22 // A callback class that all mixer participants must inherit from/implement. | 28 // A callback class that all mixer participants must inherit from/implement. |
23 class MixerAudioSource { | 29 class MixerAudioSource { |
24 public: | 30 public: |
25 enum class AudioFrameInfo { | 31 enum class AudioFrameInfo { |
26 kNormal, // The samples in audio_frame are valid and should be used. | 32 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 | 33 kMuted, // The samples in audio_frame should not be used, but should be |
28 // implicitly interpreted as zero. Other fields in audio_frame | 34 // implicitly interpreted as zero. Other fields in audio_frame |
29 // may be read and should contain meaningful values. | 35 // may be read and should contain meaningful values. |
30 kError // audio_frame will not be used. | 36 kError // audio_frame will not be used. |
31 }; | 37 }; |
32 | 38 |
| 39 // !!!: Document life expectancy of the AudioFrame* - how long can the client |
| 40 // access it? |
33 struct AudioFrameWithMuted { | 41 struct AudioFrameWithMuted { |
34 AudioFrame* audio_frame; | 42 AudioFrame* audio_frame; |
35 AudioFrameInfo audio_frame_info; | 43 AudioFrameInfo audio_frame_info; |
36 }; | 44 }; |
37 | 45 |
| 46 // !!!: Get rid of "id" |
| 47 |
38 // The implementation of GetAudioFrameWithMuted should update | 48 // The implementation of GetAudioFrameWithMuted should update |
39 // audio_frame with new audio every time it's called. Implementing | 49 // audio_frame with new audio every time it's called. Implementing |
40 // classes are allowed to return the same AudioFrame pointer on | 50 // classes are allowed to return the same AudioFrame pointer on |
41 // different calls. The pointer must stay valid until the next | 51 // different calls. The pointer must stay valid until the next |
42 // mixing call or until this audio source is disconnected from the | 52 // mixing call or until this audio source is disconnected from the |
43 // mixer. | 53 // mixer. |
44 virtual AudioFrameWithMuted GetAudioFrameWithMuted(int32_t id, | 54 virtual AudioFrameWithMuted GetAudioFrameWithMuted(int32_t id, |
45 int sample_rate_hz) = 0; | 55 int sample_rate_hz) = 0; |
46 | 56 |
47 // Returns true if the audio source was mixed this mix iteration. | 57 // Returns true if the audio source was mixed this mix iteration. |
(...skipping 11 matching lines...) Expand all Loading... |
59 private: | 69 private: |
60 bool is_mixed_; | 70 bool is_mixed_; |
61 | 71 |
62 protected: | 72 protected: |
63 MixerAudioSource(); | 73 MixerAudioSource(); |
64 virtual ~MixerAudioSource(); | 74 virtual ~MixerAudioSource(); |
65 }; | 75 }; |
66 } // namespace webrtc | 76 } // namespace webrtc |
67 | 77 |
68 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ | 78 #endif // WEBRTC_MODULES_AUDIO_MIXER_AUDIO_MIXER_DEFINES_H_ |
OLD | NEW |