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 24 matching lines...) Expand all Loading... |
35 kError, // The audio_frame will not be used. | 35 kError, // The audio_frame will not be used. |
36 }; | 36 }; |
37 | 37 |
38 // Overwrites |audio_frame|. The data_ field is overwritten with | 38 // Overwrites |audio_frame|. The data_ field is overwritten with |
39 // 10 ms of new audio (either 1 or 2 interleaved channels) at | 39 // 10 ms of new audio (either 1 or 2 interleaved channels) at |
40 // |sample_rate_hz|. All fields in |audio_frame| must be updated. | 40 // |sample_rate_hz|. All fields in |audio_frame| must be updated. |
41 virtual AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, | 41 virtual AudioFrameInfo GetAudioFrameWithInfo(int sample_rate_hz, |
42 AudioFrame* audio_frame) = 0; | 42 AudioFrame* audio_frame) = 0; |
43 | 43 |
44 // A way for a mixer implementation to distinguish participants. | 44 // A way for a mixer implementation to distinguish participants. |
45 virtual int Ssrc() = 0; | 45 virtual int Ssrc() const = 0; |
| 46 |
| 47 // A way for this source to say that GetAudioFrameWithInfo called |
| 48 // with this sample rate or higher will not cause quality loss. |
| 49 virtual int PreferredSampleRate() const = 0; |
46 | 50 |
47 virtual ~Source() {} | 51 virtual ~Source() {} |
48 }; | 52 }; |
49 | 53 |
50 // Returns true if adding/removing was successful. A source is never | 54 // Returns true if adding/removing was successful. A source is never |
51 // 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 |
52 // been successfully added to the mixer. Addition and removal can | 56 // been successfully added to the mixer. Addition and removal can |
53 // happen on different threads. | 57 // happen on different threads. |
54 virtual bool AddSource(Source* audio_source) = 0; | 58 virtual bool AddSource(Source* audio_source) = 0; |
55 virtual bool RemoveSource(Source* audio_source) = 0; | 59 virtual bool RemoveSource(Source* audio_source) = 0; |
56 | 60 |
57 // Performs mixing by asking registered audio sources for audio. The | 61 // Performs mixing by asking registered audio sources for audio. The |
58 // mixed result is placed in the provided AudioFrame. This method | 62 // mixed result is placed in the provided AudioFrame. This method |
59 // will only be called from a single thread. The rate and channels | 63 // will only be called from a single thread. The rate and channels |
60 // arguments specify the rate and number of channels of the mix | 64 // arguments specify the rate and number of channels of the mix |
61 // result. All fields in |audio_frame_for_mixing| must be updated. | 65 // result. All fields in |audio_frame_for_mixing| must be updated. |
62 virtual void Mix(int sample_rate_hz, | 66 virtual void Mix(int sample_rate_hz, |
63 size_t number_of_channels, | 67 size_t number_of_channels, |
64 AudioFrame* audio_frame_for_mixing) = 0; | 68 AudioFrame* audio_frame_for_mixing) = 0; |
65 | 69 |
66 protected: | 70 protected: |
67 // Since the mixer is reference counted, the destructor may be | 71 // Since the mixer is reference counted, the destructor may be |
68 // called from any thread. | 72 // called from any thread. |
69 ~AudioMixer() override {} | 73 ~AudioMixer() override {} |
70 }; | 74 }; |
71 } // namespace webrtc | 75 } // namespace webrtc |
72 | 76 |
73 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ | 77 #endif // WEBRTC_API_AUDIO_AUDIO_MIXER_H_ |
OLD | NEW |