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

Unified Diff: content/renderer/pepper/pepper_platform_audio_output_impl.cc

Issue 10918098: Introduce AudioOutputResampler for browser side resampling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Unittests! Bugs! 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/audio/audio_manager_base.h » ('j') | media/audio/audio_manager_base.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..389dd7b77da5da406858ec092f0a27194c0b3eaf 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) {
+
+ // TODO(dalecurtis): Limit to windows and 2ch linux/mac only since neither of
scherkus (not reviewing) 2012/09/10 12:47:47 nit: proper capitalization on Windows/Linux/Mac a
DaleCurtis 2012/09/10 14:05:51 Removed comment. After thinking about it, I intend
+ // those support multichannel currently.
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kEnableAudioOutputResampler)) {
format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
henrika (OOO until Aug 14) 2012/09/10 12:41:17 Some comments here perhaps.
DaleCurtis 2012/09/10 14:05:51 Done.
} 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) {
+ format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
+ } else {
+ format = media::AudioParameters::AUDIO_PCM_LINEAR;
+ }
}
media::AudioParameters params(format, CHANNEL_LAYOUT_STEREO, sample_rate, 16,
« no previous file with comments | « no previous file | media/audio/audio_manager_base.h » ('j') | media/audio/audio_manager_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698