| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sounds/audio_stream_handler.h" | 5 #include "media/audio/sounds/audio_stream_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/cancelable_callback.h" | 9 #include "base/cancelable_callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); | 52 DCHECK(AudioManager::Get()->GetTaskRunner()->BelongsToCurrentThread()); |
| 53 | 53 |
| 54 if (!stream_) { | 54 if (!stream_) { |
| 55 const AudioParameters& p = wav_audio_.params(); | 55 const AudioParameters& p = wav_audio_.params(); |
| 56 const AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 56 const AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 57 p.channel_layout(), | 57 p.channel_layout(), |
| 58 p.sample_rate(), | 58 p.sample_rate(), |
| 59 p.bits_per_sample(), | 59 p.bits_per_sample(), |
| 60 kDefaultFrameCount); | 60 kDefaultFrameCount); |
| 61 stream_ = AudioManager::Get()->MakeAudioOutputStreamProxy( | 61 stream_ = AudioManager::Get()->MakeAudioOutputStreamProxy( |
| 62 params, std::string(), std::string()); | 62 params, std::string()); |
| 63 if (!stream_ || !stream_->Open()) { | 63 if (!stream_ || !stream_->Open()) { |
| 64 LOG(ERROR) << "Failed to open an output stream."; | 64 LOG(ERROR) << "Failed to open an output stream."; |
| 65 return; | 65 return; |
| 66 } | 66 } |
| 67 stream_->SetVolume(kOutputVolumePercent); | 67 stream_->SetVolume(kOutputVolumePercent); |
| 68 } | 68 } |
| 69 | 69 |
| 70 { | 70 { |
| 71 base::AutoLock al(state_lock_); | 71 base::AutoLock al(state_lock_); |
| 72 | 72 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 g_observer_for_testing = observer; | 215 g_observer_for_testing = observer; |
| 216 } | 216 } |
| 217 | 217 |
| 218 // static | 218 // static |
| 219 void AudioStreamHandler::SetAudioSourceForTesting( | 219 void AudioStreamHandler::SetAudioSourceForTesting( |
| 220 AudioOutputStream::AudioSourceCallback* source) { | 220 AudioOutputStream::AudioSourceCallback* source) { |
| 221 g_audio_source_for_testing = source; | 221 g_audio_source_for_testing = source; |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace media | 224 } // namespace media |
| OLD | NEW |