| 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_output_resampler.h" | 5 #include "media/audio/audio_output_resampler.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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 } | 134 } |
| 135 | 135 |
| 136 // TODO(dalecurtis): All this code should be merged into AudioOutputMixer once | 136 // TODO(dalecurtis): All this code should be merged into AudioOutputMixer once |
| 137 // we've stabilized the issues there. | 137 // we've stabilized the issues there. |
| 138 dispatcher_ = new AudioOutputDispatcherImpl( | 138 dispatcher_ = new AudioOutputDispatcherImpl( |
| 139 audio_manager_, output_params_, close_delay_); | 139 audio_manager_, output_params_, close_delay_); |
| 140 } | 140 } |
| 141 | 141 |
| 142 bool AudioOutputResampler::OpenStream() { | 142 bool AudioOutputResampler::OpenStream() { |
| 143 if (dispatcher_->OpenStream()) { | 143 if (dispatcher_->OpenStream()) { |
| 144 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", false); | 144 if (output_params_.format() == AudioParameters::AUDIO_PCM_LOW_LATENCY) |
| 145 UMA_HISTOGRAM_BOOLEAN("Media.FallbackToHighLatencyAudioPath", false); |
| 145 return true; | 146 return true; |
| 146 } | 147 } |
| 147 | 148 |
| 148 // If we've already tried to open the stream in high latency mode, there's | 149 // If we've already tried to open the stream in high latency mode, there's |
| 149 // nothing more to be done. | 150 // nothing more to be done. |
| 150 if (output_params_.format() == AudioParameters::AUDIO_PCM_LINEAR) | 151 if (output_params_.format() == AudioParameters::AUDIO_PCM_LINEAR) |
| 151 return false; | 152 return false; |
| 152 | 153 |
| 153 DLOG(ERROR) << "Unable to open audio device in low latency mode. Falling " | 154 DLOG(ERROR) << "Unable to open audio device in low latency mode. Falling " |
| 154 << "back to high latency audio output."; | 155 << "back to high latency audio output."; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 source_callback_->OnError(stream, code); | 293 source_callback_->OnError(stream, code); |
| 293 } | 294 } |
| 294 | 295 |
| 295 void AudioOutputResampler::WaitTillDataReady() { | 296 void AudioOutputResampler::WaitTillDataReady() { |
| 296 base::AutoLock auto_lock(source_lock_); | 297 base::AutoLock auto_lock(source_lock_); |
| 297 if (source_callback_ && !outstanding_audio_bytes_) | 298 if (source_callback_ && !outstanding_audio_bytes_) |
| 298 source_callback_->WaitTillDataReady(); | 299 source_callback_->WaitTillDataReady(); |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace media | 302 } // namespace media |
| OLD | NEW |