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

Side by Side Diff: media/base/audio_renderer_mixer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_renderer_mixer.h" 5 #include "media/base/audio_renderer_mixer.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h"
12 13
13 namespace media { 14 namespace media {
14 15
15 enum { kPauseDelaySeconds = 10 }; 16 enum { kPauseDelaySeconds = 10 };
16 17
17 AudioRendererMixer::AudioRendererMixer( 18 AudioRendererMixer::AudioRendererMixer(
18 const AudioParameters& output_params, 19 const AudioParameters& output_params,
19 const scoped_refptr<AudioRendererSink>& sink) 20 const scoped_refptr<AudioRendererSink>& sink)
20 : audio_sink_(sink), 21 : audio_sink_(sink),
21 output_params_(output_params), 22 output_params_(output_params),
(...skipping 27 matching lines...) Expand all
49 50
50 int input_sample_rate = input_params.sample_rate(); 51 int input_sample_rate = input_params.sample_rate();
51 if (is_master_sample_rate(input_sample_rate)) { 52 if (is_master_sample_rate(input_sample_rate)) {
52 master_converter_.AddInput(input); 53 master_converter_.AddInput(input);
53 } else { 54 } else {
54 AudioConvertersMap::iterator converter = 55 AudioConvertersMap::iterator converter =
55 converters_.find(input_sample_rate); 56 converters_.find(input_sample_rate);
56 if (converter == converters_.end()) { 57 if (converter == converters_.end()) {
57 std::pair<AudioConvertersMap::iterator, bool> result = 58 std::pair<AudioConvertersMap::iterator, bool> result =
58 converters_.insert(std::make_pair( 59 converters_.insert(std::make_pair(
59 input_sample_rate, make_scoped_ptr( 60 input_sample_rate, base::WrapUnique(
60 // We expect all InputCallbacks to be 61 // We expect all InputCallbacks to be
61 // capable of handling arbitrary buffer 62 // capable of handling arbitrary buffer
62 // size requests, disabling FIFO. 63 // size requests, disabling FIFO.
63 new LoopbackAudioConverter( 64 new LoopbackAudioConverter(
64 input_params, output_params_, true)))); 65 input_params, output_params_, true))));
65 converter = result.first; 66 converter = result.first;
66 67
67 // Add newly-created resampler as an input to the master mixer. 68 // Add newly-created resampler as an input to the master mixer.
68 master_converter_.AddInput(converter->second.get()); 69 master_converter_.AddInput(converter->second.get());
69 } 70 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 146 }
146 147
147 void AudioRendererMixer::OnRenderError() { 148 void AudioRendererMixer::OnRenderError() {
148 // Call each mixer input and signal an error. 149 // Call each mixer input and signal an error.
149 base::AutoLock auto_lock(lock_); 150 base::AutoLock auto_lock(lock_);
150 for (const auto& cb : error_callbacks_) 151 for (const auto& cb : error_callbacks_)
151 cb.Run(); 152 cb.Run();
152 } 153 }
153 154
154 } // namespace media 155 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698