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. Addition and removal can happen on different threads. |
56 // been successfully added to the mixer. Addition and removal can | |
57 // happen on different threads. | |
58 virtual bool AddSource(Source* audio_source) = 0; | 56 virtual bool AddSource(Source* audio_source) = 0; |
59 virtual bool RemoveSource(Source* audio_source) = 0; | 57 |
| 58 // Removal is never attempted if a source has not been successfully |
| 59 // added to the mixer. |
| 60 virtual void RemoveSource(Source* audio_source) = 0; |
60 | 61 |
61 // Performs mixing by asking registered audio sources for audio. The | 62 // Performs mixing by asking registered audio sources for audio. The |
62 // mixed result is placed in the provided AudioFrame. This method | 63 // mixed result is placed in the provided AudioFrame. This method |
63 // will only be called from a single thread. The channels argument | 64 // will only be called from a single thread. The channels argument |
64 // specifies the number of channels of the mix result. The mixer | 65 // 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 | 66 // 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 | 67 // sources' audio. The mixing rate is one of the rates listed in |
67 // AudioProcessing::NativeRate. All fields in | 68 // AudioProcessing::NativeRate. All fields in |
68 // |audio_frame_for_mixing| must be updated. | 69 // |audio_frame_for_mixing| must be updated. |
69 virtual void Mix(size_t number_of_channels, | 70 virtual void Mix(size_t number_of_channels, |
70 AudioFrame* audio_frame_for_mixing) = 0; | 71 AudioFrame* audio_frame_for_mixing) = 0; |
71 | 72 |
72 protected: | 73 protected: |
73 // Since the mixer is reference counted, the destructor may be | 74 // Since the mixer is reference counted, the destructor may be |
74 // called from any thread. | 75 // called from any thread. |
75 ~AudioMixer() override {} | 76 ~AudioMixer() override {} |
76 }; | 77 }; |
77 } // namespace webrtc | 78 } // namespace webrtc |
78 | 79 |
79 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ | 80 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ |
OLD | NEW |