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

Side by Side Diff: content/renderer/pepper/pepper_platform_audio_output_impl.cc

Issue 10928147: Flip AudioOutputResampler to on by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/renderer/pepper/pepper_platform_audio_output_impl.h" 5 #include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 DCHECK(client); 118 DCHECK(client);
119 // Make sure we don't call init more than once. 119 // Make sure we don't call init more than once.
120 DCHECK_EQ(0, stream_id_); 120 DCHECK_EQ(0, stream_id_);
121 121
122 client_ = client; 122 client_ = client;
123 123
124 media::AudioParameters::Format format; 124 media::AudioParameters::Format format;
125 const int kMaxFramesForLowLatency = 2047; 125 const int kMaxFramesForLowLatency = 2047;
126 126
127 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); 127 const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
128 if (cmd_line->HasSwitch(switches::kEnableAudioOutputResampler)) { 128 if (!cmd_line->HasSwitch(switches::kDisableAudioOutputResampler)) {
129 // Rely on AudioOutputResampler to handle any inconsistencies between the 129 // Rely on AudioOutputResampler to handle any inconsistencies between the
130 // hardware params required for low latency and the requested params. 130 // hardware params required for low latency and the requested params.
131 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 131 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
132 } else if (sample_rate == audio_hardware::GetOutputSampleRate() && 132 } else if (sample_rate == audio_hardware::GetOutputSampleRate() &&
133 frames_per_buffer <= kMaxFramesForLowLatency && 133 frames_per_buffer <= kMaxFramesForLowLatency &&
134 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { 134 frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
135 // Use the low latency back end if the client request is compatible, and 135 // Use the low latency back end if the client request is compatible, and
136 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. 136 // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY.
137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; 137 format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
138 } else { 138 } else {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 172
173 ipc_->CloseStream(stream_id_); 173 ipc_->CloseStream(stream_id_);
174 ipc_->RemoveDelegate(stream_id_); 174 ipc_->RemoveDelegate(stream_id_);
175 stream_id_ = 0; 175 stream_id_ = 0;
176 176
177 Release(); // Release for the delegate, balances out the reference taken in 177 Release(); // Release for the delegate, balances out the reference taken in
178 // PepperPluginDelegateImpl::CreateAudio. 178 // PepperPluginDelegateImpl::CreateAudio.
179 } 179 }
180 180
181 } // namespace content 181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698