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 explicit CompositionConverter( | 110 CompositionConverter(std::vector<std::unique_ptr<AudioConverter>> converters) |
111 std::vector<std::unique_ptr<AudioConverter>> converters) | |
112 : converters_(std::move(converters)) { | 111 : converters_(std::move(converters)) { |
113 RTC_CHECK_GE(converters_.size(), 2); | 112 RTC_CHECK_GE(converters_.size(), 2); |
114 // We need an intermediate buffer after every converter. | 113 // We need an intermediate buffer after every converter. |
115 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) | 114 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) |
116 buffers_.push_back( | 115 buffers_.push_back( |
117 std::unique_ptr<ChannelBuffer<float>>(new ChannelBuffer<float>( | 116 std::unique_ptr<ChannelBuffer<float>>(new ChannelBuffer<float>( |
118 (*it)->dst_frames(), (*it)->dst_channels()))); | 117 (*it)->dst_frames(), (*it)->dst_channels()))); |
119 } | 118 } |
120 ~CompositionConverter() override {}; | 119 ~CompositionConverter() override {}; |
121 | 120 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || | 197 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || |
199 src_channels == 1); | 198 src_channels == 1); |
200 } | 199 } |
201 | 200 |
202 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { | 201 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { |
203 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); | 202 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); |
204 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); | 203 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); |
205 } | 204 } |
206 | 205 |
207 } // namespace webrtc | 206 } // namespace webrtc |
OLD | NEW |