Chromium Code Reviews| 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/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 | 378 |
| 379 AudioParameters AudioManagerBase::GetPreferredLowLatencyOutputStreamParameters( | 379 AudioParameters AudioManagerBase::GetPreferredLowLatencyOutputStreamParameters( |
| 380 const AudioParameters& input_params) { | 380 const AudioParameters& input_params) { |
| 381 #if defined(OS_IOS) | 381 #if defined(OS_IOS) |
| 382 // IOS implements audio input only. | 382 // IOS implements audio input only. |
| 383 NOTIMPLEMENTED(); | 383 NOTIMPLEMENTED(); |
| 384 return AudioParameters(); | 384 return AudioParameters(); |
| 385 #else | 385 #else |
| 386 // TODO(dalecurtis): This should include bits per channel and channel layout | 386 // TODO(dalecurtis): This should include bits per channel and channel layout |
| 387 // eventually. | 387 // eventually. |
| 388 AudioParameters default_params = GetDefaultOutputStreamParameters(); | |
| 388 return AudioParameters( | 389 return AudioParameters( |
| 389 AudioParameters::AUDIO_PCM_LOW_LATENCY, | 390 AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 390 input_params.channel_layout(), input_params.input_channels(), | 391 input_params.channel_layout(), input_params.input_channels(), |
| 391 GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize()); | 392 default_params.sample_rate(), 16, default_params.frames_per_buffer()); |
| 392 #endif // defined(OS_IOS) | 393 #endif // defined(OS_IOS) |
| 393 } | 394 } |
| 394 | 395 |
| 395 void AudioManagerBase::AddOutputDeviceChangeListener( | 396 void AudioManagerBase::AddOutputDeviceChangeListener( |
| 396 AudioDeviceListener* listener) { | 397 AudioDeviceListener* listener) { |
| 397 DCHECK(message_loop_->BelongsToCurrentThread()); | 398 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 398 output_listeners_.AddObserver(listener); | 399 output_listeners_.AddObserver(listener); |
| 399 } | 400 } |
| 400 | 401 |
| 401 void AudioManagerBase::RemoveOutputDeviceChangeListener( | 402 void AudioManagerBase::RemoveOutputDeviceChangeListener( |
| 402 AudioDeviceListener* listener) { | 403 AudioDeviceListener* listener) { |
| 403 DCHECK(message_loop_->BelongsToCurrentThread()); | 404 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 404 output_listeners_.RemoveObserver(listener); | 405 output_listeners_.RemoveObserver(listener); |
| 405 } | 406 } |
| 406 | 407 |
| 408 AudioParameters AudioManagerBase::GetDefaultOutputStreamParameters() { | |
| 409 return AudioParameters(); | |
|
Chris Rogers
2013/02/27 20:06:14
seems a bit dangerous -- should probably add NOTRE
tommi (sloooow) - chröme
2013/03/01 11:29:29
Can we make these methods pure virtual?
no longer working on chromium
2013/03/01 16:44:33
Done.
no longer working on chromium
2013/03/01 16:44:33
I make it pure virtual to for the developer to imp
| |
| 410 } | |
| 411 | |
| 412 AudioParameters AudioManagerBase::GetDefaultInputStreamParameters( | |
| 413 const std::string& device_id) { | |
| 414 return AudioParameters(); | |
|
Chris Rogers
2013/02/27 20:06:14
seems a bit dangerous -- should probably add NOTRE
no longer working on chromium
2013/03/01 16:44:33
Done.
| |
| 415 } | |
| 416 | |
| 407 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { | 417 void AudioManagerBase::NotifyAllOutputDeviceChangeListeners() { |
| 408 DCHECK(message_loop_->BelongsToCurrentThread()); | 418 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 409 DVLOG(1) << "Firing OnDeviceChange() notifications."; | 419 DVLOG(1) << "Firing OnDeviceChange() notifications."; |
| 410 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange()); | 420 FOR_EACH_OBSERVER(AudioDeviceListener, output_listeners_, OnDeviceChange()); |
| 411 } | 421 } |
| 412 | 422 |
| 413 } // namespace media | 423 } // namespace media |
| OLD | NEW |