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