| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 private: | 99 private: |
| 100 ScopedVector<PushSincResampler> resamplers_; | 100 ScopedVector<PushSincResampler> resamplers_; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // Apply a vector of converters in serial, in the order given. At least two | 103 // Apply a vector of converters in serial, in the order given. At least two |
| 104 // converters must be provided. | 104 // converters must be provided. |
| 105 class CompositionConverter : public AudioConverter { | 105 class CompositionConverter : public AudioConverter { |
| 106 public: | 106 public: |
| 107 CompositionConverter(ScopedVector<AudioConverter> converters) | 107 CompositionConverter(ScopedVector<AudioConverter> converters) |
| 108 : converters_(converters.Pass()) { | 108 : converters_(converters.Pass()) { |
| 109 CHECK_GE(converters_.size(), 2u); | 109 RTC_CHECK_GE(converters_.size(), 2u); |
| 110 // We need an intermediate buffer after every converter. | 110 // We need an intermediate buffer after every converter. |
| 111 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) | 111 for (auto it = converters_.begin(); it != converters_.end() - 1; ++it) |
| 112 buffers_.push_back(new ChannelBuffer<float>((*it)->dst_frames(), | 112 buffers_.push_back(new ChannelBuffer<float>((*it)->dst_frames(), |
| 113 (*it)->dst_channels())); | 113 (*it)->dst_channels())); |
| 114 } | 114 } |
| 115 ~CompositionConverter() override {}; | 115 ~CompositionConverter() override {}; |
| 116 | 116 |
| 117 void Convert(const float* const* src, size_t src_size, float* const* dst, | 117 void Convert(const float* const* src, size_t src_size, float* const* dst, |
| 118 size_t dst_capacity) override { | 118 size_t dst_capacity) override { |
| 119 converters_.front()->Convert(src, src_size, buffers_.front()->channels(), | 119 converters_.front()->Convert(src, src_size, buffers_.front()->channels(), |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 src_frames_(0), | 181 src_frames_(0), |
| 182 dst_channels_(0), | 182 dst_channels_(0), |
| 183 dst_frames_(0) {} | 183 dst_frames_(0) {} |
| 184 | 184 |
| 185 AudioConverter::AudioConverter(int src_channels, size_t src_frames, | 185 AudioConverter::AudioConverter(int src_channels, size_t src_frames, |
| 186 int dst_channels, size_t dst_frames) | 186 int dst_channels, size_t dst_frames) |
| 187 : src_channels_(src_channels), | 187 : src_channels_(src_channels), |
| 188 src_frames_(src_frames), | 188 src_frames_(src_frames), |
| 189 dst_channels_(dst_channels), | 189 dst_channels_(dst_channels), |
| 190 dst_frames_(dst_frames) { | 190 dst_frames_(dst_frames) { |
| 191 CHECK(dst_channels == src_channels || dst_channels == 1 || src_channels == 1); | 191 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || |
| 192 src_channels == 1); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { | 195 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { |
| 195 CHECK_EQ(src_size, src_channels() * src_frames()); | 196 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); |
| 196 CHECK_GE(dst_capacity, dst_channels() * dst_frames()); | 197 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); |
| 197 } | 198 } |
| 198 | 199 |
| 199 } // namespace webrtc | 200 } // namespace webrtc |
| OLD | NEW |