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

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: Comments. 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_output_resampler.h » ('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..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,
« no previous file with comments | « no previous file | media/audio/audio_manager_base.h » ('j') | media/audio/audio_output_resampler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698