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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // Returns true if adding/removing was successful. A source is never | 54 // Returns true if adding/removing was successful. A source is never |
55 // added twice and removal is never attempted if a source has not | 55 // added twice and removal is never attempted if a source has not |
56 // been successfully added to the mixer. Addition and removal can | 56 // been successfully added to the mixer. Addition and removal can |
57 // happen on different threads. | 57 // happen on different threads. |
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 bool 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 rate and channels | 63 // will only be called from a single thread. The channels argument |
64 // arguments specify the rate and number of channels of the mix | 64 // specifies the number of channels of the mix result. The mixer |
65 // result. All fields in |audio_frame_for_mixing| must be updated. | 65 // should mix at a rate that doesn't cause quality loss of the |
66 virtual void Mix(int sample_rate_hz, | 66 // sources' audio. The mixing rate is one of the rates listed in |
67 size_t number_of_channels, | 67 // AudioProcessing::NativeRate. All fields in |
| 68 // |audio_frame_for_mixing| must be updated. |
| 69 virtual void Mix(size_t number_of_channels, |
68 AudioFrame* audio_frame_for_mixing) = 0; | 70 AudioFrame* audio_frame_for_mixing) = 0; |
69 | 71 |
70 protected: | 72 protected: |
71 // Since the mixer is reference counted, the destructor may be | 73 // Since the mixer is reference counted, the destructor may be |
72 // called from any thread. | 74 // called from any thread. |
73 ~AudioMixer() override {} | 75 ~AudioMixer() override {} |
74 }; | 76 }; |
75 } // namespace webrtc | 77 } // namespace webrtc |
76 | 78 |
77 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ | 79 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ |
OLD | NEW |