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

Unified Diff: media/base/audio_renderer_mixer.h

Issue 10698066: Switch to pcm_low_latency and enable resampling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: First Look! Created 8 years, 6 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/base/audio_renderer_mixer.cc » ('j') | media/base/audio_renderer_mixer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_renderer_mixer.h
diff --git a/media/base/audio_renderer_mixer.h b/media/base/audio_renderer_mixer.h
index 32102ffb1d5ff119c630d82ada115d763350faa4..974620b419211b7b867615f1c152c1ff13f1aceb 100644
--- a/media/base/audio_renderer_mixer.h
+++ b/media/base/audio_renderer_mixer.h
@@ -12,16 +12,20 @@
#include "base/synchronization/lock.h"
#include "media/base/audio_renderer_mixer_input.h"
#include "media/base/audio_renderer_sink.h"
+#include "media/base/multi_channel_resampler.h"
namespace media {
// Mixes a set of AudioRendererMixerInputs into a single output stream which is
// funneled into a single shared AudioRendererSink; saving a bundle on renderer
-// side resources.
-// TODO(dalecurtis): Update documentation once resampling is available.
+// side resources. Resampling is done post-mixing as it is the most expensive
+// process. If the input sample rate matches the audio hardware sample rate, no
+// resampling is done.
class MEDIA_EXPORT AudioRendererMixer
: public base::RefCountedThreadSafe<AudioRendererMixer>,
- NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback) {
+ NON_EXPORTED_BASE(public AudioRendererSink::RenderCallback),
+ NON_EXPORTED_BASE(
+ public MultiChannelResampler::MultiChannelAudioSourceProvider) {
public:
AudioRendererMixer(const AudioParameters& params,
const scoped_refptr<AudioRendererSink>& sink);
@@ -41,8 +45,16 @@ class MEDIA_EXPORT AudioRendererMixer
int audio_delay_milliseconds) OVERRIDE;
virtual void OnRenderError() OVERRIDE;
- // AudioParameters this mixer was constructed with.
- AudioParameters audio_parameters_;
+ // MultiChannelResampler::MultiChannelAudioSourceProvider implementation and
+ // main worker method for AudioRendererMixer. Handles mixing and volume
+ // adjustment. Renders |number_of_frames| into |audio_data|. When resampling
+ // is necessary, ProvideInput() will be called by MultiChannelResampler when
+ // more data is necessary.
+ virtual void ProvideInput(const std::vector<float*>& audio_data,
+ int number_of_frames) OVERRIDE;
+
+ // AudioParameters this mixer will output with.
+ AudioParameters output_parameters_;
// Output sink for this mixer.
scoped_refptr<AudioRendererSink> audio_sink_;
@@ -54,6 +66,15 @@ class MEDIA_EXPORT AudioRendererMixer
AudioRendererMixerInputSet mixer_inputs_;
base::Lock mixer_inputs_lock_;
+ // Vector for rendering audio data from each mixer input.
+ std::vector<float*> mixer_input_audio_data_;
+
+ // Handles resampling post-mixing.
+ scoped_ptr<MultiChannelResampler> resampler_;
+
+ // The audio delay in milliseconds received by the last Render() call.
+ int current_audio_delay_milliseconds_;
+
DISALLOW_COPY_AND_ASSIGN(AudioRendererMixer);
};
« no previous file with comments | « no previous file | media/base/audio_renderer_mixer.cc » ('j') | media/base/audio_renderer_mixer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698