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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »
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..42265ea53f1cde59bcfc3591af9f7ad3b429e385 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 {
@@ -121,11 +123,17 @@ bool PepperPlatformAudioOutputImpl::Initialize(
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)) {
+ // Rely on AudioOutputResampler to handle any inconsistencies between the
+ // hardware params required for low latency and the requested params.
+ format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
+ } else if (sample_rate == audio_hardware::GetOutputSampleRate() &&
+ frames_per_buffer <= kMaxFramesForLowLatency &&
+ frames_per_buffer % audio_hardware::GetOutputBufferSize() == 0) {
+ // 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.
format = media::AudioParameters::AUDIO_PCM_LOW_LATENCY;
} else {
format = media::AudioParameters::AUDIO_PCM_LINEAR;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | media/audio/audio_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698