diff options
author | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 04:24:19 +0000 |
---|---|---|
committer | dalecurtis@chromium.org <dalecurtis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 04:24:19 +0000 |
commit | 4187ea43e11dd33ec2d542edd76163d8fc7ed1c1 (patch) | |
tree | 142e57255a31a095905e78423279f1fa2f4eb42e /media/base/fake_audio_render_callback.cc | |
parent | 2d115a11ba119dc8d3df465b3fdb96fb94a0e1bc (diff) | |
download | chromium_src-4187ea43e11dd33ec2d542edd76163d8fc7ed1c1.zip chromium_src-4187ea43e11dd33ec2d542edd76163d8fc7ed1c1.tar.gz chromium_src-4187ea43e11dd33ec2d542edd76163d8fc7ed1c1.tar.bz2 |
Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform.
Currently we have roughly equivalent functionality in two places, and
the CloudView project will add a third. As such there's a need for a
single super class which can handle mixing, resampling, and general
conversion from one set of AudioParameters to another.
This change introduces the AudioTransform object which collapses the
key functionality from AudioRendererMixer and OnMoreDataResampler into
a single AudioTransform class which can do everything and is oblivious
to the peculiars of RenderCallback vs AudioSourceCallback.
It also introduces output_frames_ready() methods to the AudioPullFifo
and MultiChannelResampler classes so that buffer delay can be measured
accurately without resorting to input vs output byte counting.
Due to the bulk of AudioRendererMixer's functionality moving into the
new AudioTransform, it made sense to move some decisions into the
AudioRendererMixerInput class as well.
On my Z600, benchmarking 50000 iterations:
Convert() w/ FIFO took 7030.11ms.
Convert() w/o FIFO took 5218.83ms.
BUG=none
TEST=AudioTransform* unittests.
TBR=sergeyu
Review URL: https://chromiumcodereview.appspot.com/11410012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/fake_audio_render_callback.cc')
-rw-r--r-- | media/base/fake_audio_render_callback.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/media/base/fake_audio_render_callback.cc b/media/base/fake_audio_render_callback.cc index 65b6ac9..af55910 100644 --- a/media/base/fake_audio_render_callback.cc +++ b/media/base/fake_audio_render_callback.cc @@ -5,16 +5,17 @@ // MSVC++ requires this to be set before any other includes to get M_PI. #define _USE_MATH_DEFINES -#include "media/base/fake_audio_render_callback.h" - #include <cmath> +#include "media/base/fake_audio_render_callback.h" + namespace media { FakeAudioRenderCallback::FakeAudioRenderCallback(double step) : half_fill_(false), step_(step), - last_audio_delay_milliseconds_(-1) { + last_audio_delay_milliseconds_(-1), + volume_(1) { reset(); } @@ -40,4 +41,10 @@ int FakeAudioRenderCallback::Render(AudioBus* audio_bus, return number_of_frames; } +double FakeAudioRenderCallback::ProvideInput(AudioBus* audio_bus, + base::TimeDelta buffer_delay) { + Render(audio_bus, buffer_delay.InMilliseconds()); + return volume_; +} + } // namespace media |