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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 if (dispatcher_->OpenStream()) { | 234 if (dispatcher_->OpenStream()) { |
235 streams_opened_ = true; | 235 streams_opened_ = true; |
236 return true; | 236 return true; |
237 } | 237 } |
238 #endif | 238 #endif |
239 | 239 |
240 DLOG(ERROR) << "Unable to open audio device in high latency mode. Falling " | 240 DLOG(ERROR) << "Unable to open audio device in high latency mode. Falling " |
241 << "back to fake audio output."; | 241 << "back to fake audio output."; |
242 | 242 |
243 // Finally fall back to a fake audio output device. | 243 // Finally fall back to a fake audio output device. |
244 output_params_.Reset( | 244 output_params_ = params_; |
245 AudioParameters::AUDIO_FAKE, params_.channel_layout(), | 245 output_params_.set_format(AudioParameters::AUDIO_FAKE); |
246 params_.channels(), params_.sample_rate(), | 246 |
247 params_.bits_per_sample(), params_.frames_per_buffer()); | |
248 Initialize(); | 247 Initialize(); |
249 if (dispatcher_->OpenStream()) { | 248 if (dispatcher_->OpenStream()) { |
250 streams_opened_ = true; | 249 streams_opened_ = true; |
251 return true; | 250 return true; |
252 } | 251 } |
253 | 252 |
254 return false; | 253 return false; |
255 } | 254 } |
256 | 255 |
257 bool AudioOutputResampler::StartStream( | 256 bool AudioOutputResampler::StartStream( |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 if (frames > 0 && frames < dest->frames()) | 382 if (frames > 0 && frames < dest->frames()) |
384 dest->ZeroFramesPartial(frames, dest->frames() - frames); | 383 dest->ZeroFramesPartial(frames, dest->frames() - frames); |
385 return frames > 0 ? 1 : 0; | 384 return frames > 0 ? 1 : 0; |
386 } | 385 } |
387 | 386 |
388 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { | 387 void OnMoreDataConverter::OnError(AudioOutputStream* stream) { |
389 source_callback_->OnError(stream); | 388 source_callback_->OnError(stream); |
390 } | 389 } |
391 | 390 |
392 } // namespace media | 391 } // namespace media |
OLD | NEW |