OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 #ifndef WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ |
12 #define WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ | 12 #define WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
18 #include "webrtc/modules/include/module_common_types.h" | 18 #include "webrtc/modules/include/module_common_types.h" |
19 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
22 class FrameCombiner { | 22 class FrameCombiner { |
23 public: | 23 public: |
24 explicit FrameCombiner(bool use_apm_limiter); | 24 explicit FrameCombiner(bool use_apm_limiter); |
25 ~FrameCombiner(); | 25 ~FrameCombiner(); |
26 | 26 |
27 // Combine several frames into one. Assumes sample_rate, | 27 // Combine several frames into one. Assumes sample_rate, |
28 // samples_per_channel of the input frames match the parameters. The | 28 // samples_per_channel of the input frames match the parameters. The |
29 // extra parameters are needed because 'mix_list' can be empty. | 29 // parameters 'number_of_channels' and 'sample_rate' are needed |
| 30 // because 'mix_list' can be empty. The parameter |
| 31 // 'number_of_streams' is used for determining whether to pass the |
| 32 // data through a limiter. |
30 void Combine(const std::vector<AudioFrame*>& mix_list, | 33 void Combine(const std::vector<AudioFrame*>& mix_list, |
31 size_t number_of_channels, | 34 size_t number_of_channels, |
32 int sample_rate, | 35 int sample_rate, |
| 36 size_t number_of_streams, |
33 AudioFrame* audio_frame_for_mixing) const; | 37 AudioFrame* audio_frame_for_mixing) const; |
34 | 38 |
35 private: | 39 private: |
36 // Lower-level helper function called from Combine(...) when there | |
37 // are several input frames. | |
38 // | |
39 // TODO(aleloi): change interface to ArrayView<int16_t> output_frame | |
40 // once we have gotten rid of the APM limiter. | |
41 // | |
42 // Only the 'data' field of output_frame should be modified. The | |
43 // rest are used for potentially sending the output to the APM | |
44 // limiter. | |
45 void CombineMultipleFrames( | |
46 const std::vector<rtc::ArrayView<const int16_t>>& input_frames, | |
47 AudioFrame* audio_frame_for_mixing) const; | |
48 | |
49 const bool use_apm_limiter_; | 40 const bool use_apm_limiter_; |
50 std::unique_ptr<AudioProcessing> limiter_; | 41 std::unique_ptr<AudioProcessing> limiter_; |
51 }; | 42 }; |
52 } // namespace webrtc | 43 } // namespace webrtc |
53 | 44 |
54 #endif // WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ | 45 #endif // WEBRTC_MODULES_AUDIO_MIXER_FRAME_COMBINER_H_ |
OLD | NEW |