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

Side by Side Diff: media/base/audio_buffer_converter.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/audio_buffer_converter.h" 5 #include "media/base/audio_buffer_converter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 if (!request_frames) 187 if (!request_frames)
188 return; 188 return;
189 189
190 scoped_refptr<AudioBuffer> output_buffer = 190 scoped_refptr<AudioBuffer> output_buffer =
191 AudioBuffer::CreateBuffer(kSampleFormatPlanarF32, 191 AudioBuffer::CreateBuffer(kSampleFormatPlanarF32,
192 output_params_.channel_layout(), 192 output_params_.channel_layout(),
193 output_params_.channels(), 193 output_params_.channels(),
194 output_params_.sample_rate(), 194 output_params_.sample_rate(),
195 request_frames); 195 request_frames);
196 scoped_ptr<AudioBus> output_bus = 196 std::unique_ptr<AudioBus> output_bus =
197 AudioBus::CreateWrapper(output_buffer->channel_count()); 197 AudioBus::CreateWrapper(output_buffer->channel_count());
198 198
199 int frames_remaining = request_frames; 199 int frames_remaining = request_frames;
200 200
201 // The AudioConverter wants requests of a fixed size, so we'll slide an 201 // The AudioConverter wants requests of a fixed size, so we'll slide an
202 // AudioBus of that size across the |output_buffer|. 202 // AudioBus of that size across the |output_buffer|.
203 while (frames_remaining != 0) { 203 while (frames_remaining != 0) {
204 // It's important that this is a multiple of AudioBus::kChannelAlignment in 204 // It's important that this is a multiple of AudioBus::kChannelAlignment in
205 // all requests except for the last, otherwise downstream SIMD optimizations 205 // all requests except for the last, otherwise downstream SIMD optimizations
206 // will crash on unaligned data. 206 // will crash on unaligned data.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 is_flushing_ = false; 240 is_flushing_ = false;
241 audio_converter_->Reset(); 241 audio_converter_->Reset();
242 DCHECK_EQ(input_frames_, 0); 242 DCHECK_EQ(input_frames_, 0);
243 DCHECK_EQ(last_input_buffer_offset_, 0); 243 DCHECK_EQ(last_input_buffer_offset_, 0);
244 DCHECK_LT(buffered_input_frames_, 1.0); 244 DCHECK_LT(buffered_input_frames_, 1.0);
245 DCHECK(queued_inputs_.empty()); 245 DCHECK(queued_inputs_.empty());
246 buffered_input_frames_ = 0.0; 246 buffered_input_frames_ = 0.0;
247 } 247 }
248 248
249 } // namespace media 249 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698