Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: webrtc/common_audio/audio_converter.cc

Issue 1712513002: Replace scoped_ptr with unique_ptr in webrtc/common_audio/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/common_audio/audio_converter.h ('k') | webrtc/common_audio/audio_converter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « webrtc/common_audio/audio_converter.h ('k') | webrtc/common_audio/audio_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698