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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 // A way for a mixer implementation to distinguish participants. | 44 // A way for a mixer implementation to distinguish participants. |
45 virtual int Ssrc() const = 0; | 45 virtual int Ssrc() const = 0; |
46 | 46 |
47 // A way for this source to say that GetAudioFrameWithInfo called | 47 // A way for this source to say that GetAudioFrameWithInfo called |
48 // with this sample rate or higher will not cause quality loss. | 48 // with this sample rate or higher will not cause quality loss. |
49 virtual int PreferredSampleRate() const = 0; | 49 virtual int PreferredSampleRate() const = 0; |
50 | 50 |
51 virtual ~Source() {} | 51 virtual ~Source() {} |
52 }; | 52 }; |
53 | 53 |
54 // Returns true if adding/removing was successful. A source is never | 54 // Returns true if adding was successful. A source is never added |
55 // added twice and removal is never attempted if a source has not | 55 // twice and removal is never attempted if a source has not been |
56 // been successfully added to the mixer. Addition and removal can | 56 // successfully added to the mixer. Addition and removal can happen |
57 // happen on different threads. | 57 // on different threads. |
kwiberg-webrtc
2016/11/18 02:10:12
It probably makes more sense to document these two
| |
58 virtual bool AddSource(Source* audio_source) = 0; | 58 virtual bool AddSource(Source* audio_source) = 0; |
59 virtual bool RemoveSource(Source* audio_source) = 0; | 59 virtual void RemoveSource(Source* audio_source) = 0; |
60 | 60 |
61 // Performs mixing by asking registered audio sources for audio. The | 61 // Performs mixing by asking registered audio sources for audio. The |
62 // mixed result is placed in the provided AudioFrame. This method | 62 // mixed result is placed in the provided AudioFrame. This method |
63 // will only be called from a single thread. The channels argument | 63 // will only be called from a single thread. The channels argument |
64 // specifies the number of channels of the mix result. The mixer | 64 // specifies the number of channels of the mix result. The mixer |
65 // should mix at a rate that doesn't cause quality loss of the | 65 // should mix at a rate that doesn't cause quality loss of the |
66 // sources' audio. The mixing rate is one of the rates listed in | 66 // sources' audio. The mixing rate is one of the rates listed in |
67 // AudioProcessing::NativeRate. All fields in | 67 // AudioProcessing::NativeRate. All fields in |
68 // |audio_frame_for_mixing| must be updated. | 68 // |audio_frame_for_mixing| must be updated. |
69 virtual void Mix(size_t number_of_channels, | 69 virtual void Mix(size_t number_of_channels, |
70 AudioFrame* audio_frame_for_mixing) = 0; | 70 AudioFrame* audio_frame_for_mixing) = 0; |
71 | 71 |
72 protected: | 72 protected: |
73 // Since the mixer is reference counted, the destructor may be | 73 // Since the mixer is reference counted, the destructor may be |
74 // called from any thread. | 74 // called from any thread. |
75 ~AudioMixer() override {} | 75 ~AudioMixer() override {} |
76 }; | 76 }; |
77 } // namespace webrtc | 77 } // namespace webrtc |
78 | 78 |
79 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ | 79 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ |
OLD | NEW |