| OLD | NEW |
| 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/audio/audio_manager_base.h" | 5 #include "media/audio/audio_manager_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 } | 271 } |
| 272 | 272 |
| 273 DispatcherParams* dispatcher_params = | 273 DispatcherParams* dispatcher_params = |
| 274 new DispatcherParams(params, output_params, output_device_id); | 274 new DispatcherParams(params, output_params, output_device_id); |
| 275 | 275 |
| 276 AudioOutputDispatchers::iterator it = | 276 AudioOutputDispatchers::iterator it = |
| 277 std::find_if(output_dispatchers_.begin(), output_dispatchers_.end(), | 277 std::find_if(output_dispatchers_.begin(), output_dispatchers_.end(), |
| 278 CompareByParams(dispatcher_params)); | 278 CompareByParams(dispatcher_params)); |
| 279 if (it != output_dispatchers_.end()) { | 279 if (it != output_dispatchers_.end()) { |
| 280 delete dispatcher_params; | 280 delete dispatcher_params; |
| 281 return new AudioOutputProxy((*it)->dispatcher.get()); | 281 return new AudioOutputProxy((*it)->dispatcher->AsWeakPtr()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 const base::TimeDelta kCloseDelay = | 284 const base::TimeDelta kCloseDelay = |
| 285 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); | 285 base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds); |
| 286 std::unique_ptr<AudioOutputDispatcher> dispatcher; | 286 std::unique_ptr<AudioOutputDispatcher> dispatcher; |
| 287 if (output_params.format() != AudioParameters::AUDIO_FAKE) { | 287 if (output_params.format() != AudioParameters::AUDIO_FAKE) { |
| 288 dispatcher = base::MakeUnique<AudioOutputResampler>( | 288 dispatcher = base::MakeUnique<AudioOutputResampler>( |
| 289 this, params, output_params, output_device_id, kCloseDelay); | 289 this, params, output_params, output_device_id, kCloseDelay); |
| 290 } else { | 290 } else { |
| 291 dispatcher = base::MakeUnique<AudioOutputDispatcherImpl>( | 291 dispatcher = base::MakeUnique<AudioOutputDispatcherImpl>( |
| 292 this, output_params, output_device_id, kCloseDelay); | 292 this, output_params, output_device_id, kCloseDelay); |
| 293 } | 293 } |
| 294 | 294 |
| 295 dispatcher_params->dispatcher = std::move(dispatcher); | 295 dispatcher_params->dispatcher = std::move(dispatcher); |
| 296 output_dispatchers_.push_back(dispatcher_params); | 296 output_dispatchers_.push_back(dispatcher_params); |
| 297 return new AudioOutputProxy(dispatcher_params->dispatcher.get()); | 297 return new AudioOutputProxy(dispatcher_params->dispatcher->AsWeakPtr()); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void AudioManagerBase::ShowAudioInputSettings() { | 300 void AudioManagerBase::ShowAudioInputSettings() { |
| 301 } | 301 } |
| 302 | 302 |
| 303 void AudioManagerBase::GetAudioInputDeviceNames( | 303 void AudioManagerBase::GetAudioInputDeviceNames( |
| 304 AudioDeviceNames* device_names) { | 304 AudioDeviceNames* device_names) { |
| 305 } | 305 } |
| 306 | 306 |
| 307 void AudioManagerBase::GetAudioOutputDeviceNames( | 307 void AudioManagerBase::GetAudioOutputDeviceNames( |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 return 0; | 428 return 0; |
| 429 } | 429 } |
| 430 | 430 |
| 431 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( | 431 std::unique_ptr<AudioLog> AudioManagerBase::CreateAudioLog( |
| 432 AudioLogFactory::AudioComponent component) { | 432 AudioLogFactory::AudioComponent component) { |
| 433 return audio_log_factory_->CreateAudioLog(component); | 433 return audio_log_factory_->CreateAudioLog(component); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace media | 436 } // namespace media |
| OLD | NEW |