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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 converters_.back()->Convert(buffers_.back()->channels(), | 130 converters_.back()->Convert(buffers_.back()->channels(), |
131 buffers_.back()->size(), dst, dst_capacity); | 131 buffers_.back()->size(), dst, dst_capacity); |
132 } | 132 } |
133 | 133 |
134 private: | 134 private: |
135 ScopedVector<AudioConverter> converters_; | 135 ScopedVector<AudioConverter> converters_; |
136 ScopedVector<ChannelBuffer<float>> buffers_; | 136 ScopedVector<ChannelBuffer<float>> buffers_; |
137 }; | 137 }; |
138 | 138 |
139 rtc::scoped_ptr<AudioConverter> AudioConverter::Create(size_t src_channels, | 139 std::unique_ptr<AudioConverter> AudioConverter::Create(size_t src_channels, |
140 size_t src_frames, | 140 size_t src_frames, |
141 size_t dst_channels, | 141 size_t dst_channels, |
142 size_t dst_frames) { | 142 size_t dst_frames) { |
143 rtc::scoped_ptr<AudioConverter> sp; | 143 std::unique_ptr<AudioConverter> sp; |
144 if (src_channels > dst_channels) { | 144 if (src_channels > dst_channels) { |
145 if (src_frames != dst_frames) { | 145 if (src_frames != dst_frames) { |
146 ScopedVector<AudioConverter> converters; | 146 ScopedVector<AudioConverter> converters; |
147 converters.push_back(new DownmixConverter(src_channels, src_frames, | 147 converters.push_back(new DownmixConverter(src_channels, src_frames, |
148 dst_channels, src_frames)); | 148 dst_channels, src_frames)); |
149 converters.push_back(new ResampleConverter(dst_channels, src_frames, | 149 converters.push_back(new ResampleConverter(dst_channels, src_frames, |
150 dst_channels, dst_frames)); | 150 dst_channels, dst_frames)); |
151 sp.reset(new CompositionConverter(std::move(converters))); | 151 sp.reset(new CompositionConverter(std::move(converters))); |
152 } else { | 152 } else { |
153 sp.reset(new DownmixConverter(src_channels, src_frames, dst_channels, | 153 sp.reset(new DownmixConverter(src_channels, src_frames, dst_channels, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || | 192 RTC_CHECK(dst_channels == src_channels || dst_channels == 1 || |
193 src_channels == 1); | 193 src_channels == 1); |
194 } | 194 } |
195 | 195 |
196 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { | 196 void AudioConverter::CheckSizes(size_t src_size, size_t dst_capacity) const { |
197 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); | 197 RTC_CHECK_EQ(src_size, src_channels() * src_frames()); |
198 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); | 198 RTC_CHECK_GE(dst_capacity, dst_channels() * dst_frames()); |
199 } | 199 } |
200 | 200 |
201 } // namespace webrtc | 201 } // namespace webrtc |
OLD | NEW |