OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 100 } |
101 | 101 |
102 private: | 102 private: |
103 std::vector<std::unique_ptr<PushSincResampler>> resamplers_; | 103 std::vector<std::unique_ptr<PushSincResampler>> resamplers_; |
104 }; | 104 }; |
105 | 105 |
106 // Apply a vector of converters in serial, in the order given. At least two | 106 // Apply a vector of converters in serial, in the order given. At least two |
107 // converters must be provided. | 107 // converters must be provided. |
108 class CompositionConverter : public AudioConverter { | 108 class CompositionConverter : public AudioConverter { |
109 public: | 109 public: |
110 CompositionConverter(std::vector<std::unique_ptr<AudioConverter>> converters) | 110 explicit CompositionConverter( |
| 111 std::vector<std::unique_ptr<AudioConverter>> converters) |
111 : converters_(std::move(converters)) { | 112 : converters_(std::move(converters)) { |
112 RTC_CHECK_GE(converters_.size(), 2); | 113 RTC_CHECK_GE(converters_.size(), 2); |
113 // We need an intermediate buffer after every converter. | 114 // We need an intermediate buffer after every converter. |
114 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) | 115 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) |
115 buffers_.push_back( | 116 buffers_.push_back( |
116 std::unique_ptr<ChannelBuffer<float>>(new ChannelBuffer<float>( | 117 std::unique_ptr<ChannelBuffer<float>>(new ChannelBuffer<float>( |
117 (*it)->dst_frames(), (*it)->dst_channels()))); | 118 (*it)->dst_frames(), (*it)->dst_channels()))); |
118 } | 119 } |
119 ~CompositionConverter() override {}; | 120 ~CompositionConverter() override {}; |
120 | 121 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || | 198 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || |
198 src_channels == 1); | 199 src_channels == 1); |
199 } | 200 } |
200 | 201 |
201 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { | 202 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { |
202 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); | 203 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); |
203 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); | 204 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); |
204 } | 205 } |
205 | 206 |
206 } // namespace webrtc | 207 } // namespace webrtc |
OLD | NEW |