Chromium Code Reviews| Index: content/renderer/pepper/pepper_platform_audio_output_impl.cc |
| diff --git a/content/renderer/pepper/pepper_platform_audio_output_impl.cc b/content/renderer/pepper/pepper_platform_audio_output_impl.cc |
| index 03f271e22b151adf1122d91bb9eacc0f75ea5a3d..de4d62b94d4c8b56f716076ebf992e4e42aae8ac 100644 |
| --- a/content/renderer/pepper/pepper_platform_audio_output_impl.cc |
| +++ b/content/renderer/pepper/pepper_platform_audio_output_impl.cc |
| @@ -5,6 +5,7 @@ |
| #include "content/renderer/pepper/pepper_platform_audio_output_impl.h" |
| #include "base/bind.h" |
| +#include "base/command_line.h" |
| #include "base/logging.h" |
| #include "base/message_loop_proxy.h" |
| #include "build/build_config.h" |
| @@ -13,6 +14,7 @@ |
| #include "content/renderer/media/audio_hardware.h" |
| #include "content/renderer/media/audio_message_filter.h" |
| #include "content/renderer/render_thread_impl.h" |
| +#include "media/base/media_switches.h" |
| namespace content { |
| @@ -120,15 +122,23 @@ bool PepperPlatformAudioOutputImpl::Initialize( |
| client_ = client; |
| media::AudioParameters::Format format; |
| - const int kMaxFramesForLowLatency = 2047; |
| - // Use the low latency back end if the client request is compatible, and |
| - // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. |
| - if (sample_rate == audio_hardware::GetOutputSampleRate() && |
| - frames_per_buffer <= kMaxFramesForLowLatency && |
| - frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { |
| + |
| + const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
| + if (cmd_line->HasSwitch(switches::kEnableAudioOutputResampler)) { |
|
scherkus (not reviewing)
2012/09/10 14:34:11
Doesn't this switch need to be passed via content/
DaleCurtis
2012/09/10 14:53:51
Oh yeah. This was working previously because I did
|
| + // Rely on AudioOutputResampler to handle any inconsistenties between the |
|
scherkus (not reviewing)
2012/09/10 14:25:32
sp: inconsistenties -> inconsistencies
DaleCurtis
2012/09/10 14:53:51
Done.
|
| + // hardware params required for low latency and the requested params. |
| format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; |
| } else { |
| - format = media::AudioParameters::AUDIO_PCM_LINEAR; |
| + const int kMaxFramesForLowLatency = 2047; |
| + // Use the low latency back end if the client request is compatible, and |
| + // the sample count is low enough to justify using AUDIO_PCM_LOW_LATENCY. |
| + if (sample_rate == audio_hardware::GetOutputSampleRate() && |
| + frames_per_buffer <= kMaxFramesForLowLatency && |
| + frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) { |
|
scherkus (not reviewing)
2012/09/10 14:34:11
can we de-nest this set of branches into the follo
DaleCurtis
2012/09/10 14:53:51
Done.
|
| + format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY; |
| + } else { |
| + format = media::AudioParameters::AUDIO_PCM_LINEAR; |
| + } |
| } |
| media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16, |