Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: media/audio/audio_output_resampler.cc

Issue 12261027: Don't switch to fake audio output until stream open fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_output_resampler.cc
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc
index 1fcb474fc8ae5ec971e9169ed374123d6b2e0372..4ad11885569fe10913a3eb05744d7747e5da1629 100644
--- a/media/audio/audio_output_resampler.cc
+++ b/media/audio/audio_output_resampler.cc
@@ -188,7 +188,7 @@ bool AudioOutputResampler::OpenStream() {
// If we've already tried to open the stream in high latency mode or we've
// successfully opened a stream previously, there's nothing more to be done.
- if (output_params_.format() == AudioParameters::AUDIO_PCM_LINEAR ||
+ if (output_params_.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY ||
streams_opened_ || !callbacks_.empty()) {
return false;
}
@@ -210,9 +210,26 @@ bool AudioOutputResampler::OpenStream() {
RecordFallbackStats(output_params_);
output_params_ = SetupFallbackParams(params_, output_params_);
Initialize();
+ if (dispatcher_->OpenStream()) {
+ streams_opened_ = true;
+ return true;
+ }
+
+ DLOG(ERROR) << "Unable to open audio device in high latency mode. Falling "
+ << "back to fake audio output.";
+
+ // Finally fall back to a fake audio output device.
+ output_params_.Reset(
+ AudioParameters::AUDIO_FAKE, params_.channel_layout(),
+ params_.input_channels(), params_.sample_rate(),
+ params_.bits_per_sample(), params_.frames_per_buffer());
+ Initialize();
+ if (dispatcher_->OpenStream()) {
+ streams_opened_ = true;
+ return true;
+ }
- // Retry, if this fails, there's nothing left to do but report the error back.
- return dispatcher_->OpenStream();
+ return false;
}
bool AudioOutputResampler::StartStream(
« media/audio/audio_manager_base.cc ('K') | « media/audio/audio_output_proxy_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698