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

Unified Diff: media/audio/audio_manager_base.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
Index: media/audio/audio_manager_base.cc
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index 7e5cc43afc7d9b1f152d9ac54d8fdcdde82c86ec..a45a653d7c0883cacc0689f43e5fff13a047af29 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -10,6 +10,8 @@
#include "base/threading/thread.h"
#include "media/audio/audio_output_dispatcher_impl.h"
#include "media/audio/audio_output_proxy.h"
+#include "media/audio/audio_output_resampler.h"
+#include "media/audio/audio_util.h"
#include "media/audio/fake_audio_input_stream.h"
#include "media/audio/fake_audio_output_stream.h"
#include "media/base/media_switches.h"
@@ -152,14 +154,20 @@ AudioOutputStream* AudioManagerBase::MakeAudioOutputStreamProxy(
if (!dispatcher) {
base::TimeDelta close_delay =
base::TimeDelta::FromSeconds(kStreamCloseDelaySeconds);
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kEnableAudioOutputResampler)) {
+ dispatcher = new AudioOutputResampler(
+ this, params,
+ GetPreferredLowLatencyOutputStreamParameters(params.channel_layout()),
+ close_delay);
scherkus (not reviewing) 2012/09/10 12:47:47 I think we can clean up the confusing #if code if
DaleCurtis 2012/09/10 14:05:51 Done.
+ } else
+#if defined(ENABLE_AUDIO_MIXER)
// TODO(dalecurtis): Browser side mixing has a couple issues that must be
// fixed before it can be turned on by default: http://crbug.com/138098 and
// http://crbug.com/140247
-#if defined(ENABLE_AUDIO_MIXER)
- const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- if (cmd_line->HasSwitch(switches::kEnableAudioMixer))
+ if (cmd_line->HasSwitch(switches::kEnableAudioMixer)) {
dispatcher = new AudioOutputMixer(this, params, close_delay);
- else
+ } else
#endif
dispatcher = new AudioOutputDispatcherImpl(this, params, close_delay);
}
@@ -259,4 +267,13 @@ void AudioManagerBase::ShutdownOnAudioThread() {
#endif // defined(OS_IOS)
}
+AudioParameters AudioManagerBase::GetPreferredLowLatencyOutputStreamParameters(
+ ChannelLayout channel_layout) {
+ // TODO(dalecurtis): This should include bits per channel and channel layout
+ // eventually.
+ return AudioParameters(
+ AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout,
+ GetAudioHardwareSampleRate(), 16, GetAudioHardwareBufferSize());
+}
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698