| 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..76e68bcbf209629546fc4b99e27f2ca5fd2d405e 100644
|
| --- a/media/base/audio_renderer_mixer.h
|
| +++ b/media/base/audio_renderer_mixer.h
|
| @@ -8,32 +8,30 @@
|
| #include <set>
|
| #include <vector>
|
|
|
| -#include "base/memory/ref_counted.h"
|
| #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) {
|
| public:
|
| - AudioRendererMixer(const AudioParameters& params,
|
| + AudioRendererMixer(const AudioParameters& input_params,
|
| + const AudioParameters& output_params,
|
| const scoped_refptr<AudioRendererSink>& sink);
|
| + virtual ~AudioRendererMixer();
|
|
|
| // Add or remove a mixer input from mixing; called by AudioRendererMixerInput.
|
| void AddMixerInput(const scoped_refptr<AudioRendererMixerInput>& input);
|
| void RemoveMixerInput(const scoped_refptr<AudioRendererMixerInput>& input);
|
|
|
| - protected:
|
| - friend class base::RefCountedThreadSafe<AudioRendererMixer>;
|
| - virtual ~AudioRendererMixer();
|
| -
|
| private:
|
| // AudioRendererSink::RenderCallback implementation.
|
| virtual int Render(const std::vector<float*>& audio_data,
|
| @@ -41,8 +39,11 @@ class MEDIA_EXPORT AudioRendererMixer
|
| int audio_delay_milliseconds) OVERRIDE;
|
| virtual void OnRenderError() OVERRIDE;
|
|
|
| - // AudioParameters this mixer was constructed with.
|
| - AudioParameters audio_parameters_;
|
| + // 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.
|
| + void ProvideInput(const std::vector<float*>& audio_data,
|
| + int number_of_frames);
|
|
|
| // Output sink for this mixer.
|
| scoped_refptr<AudioRendererSink> audio_sink_;
|
| @@ -54,6 +55,16 @@ class MEDIA_EXPORT AudioRendererMixer
|
| AudioRendererMixerInputSet mixer_inputs_;
|
| base::Lock mixer_inputs_lock_;
|
|
|
| + // Vector for rendering audio data from each mixer input.
|
| + int mixer_input_audio_data_size_;
|
| + 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);
|
| };
|
|
|
|
|