| Index: media/base/fake_audio_render_callback.cc
|
| diff --git a/media/base/fake_audio_render_callback.cc b/media/base/fake_audio_render_callback.cc
|
| index fb686c56c14f05e0ce34da32602c1039eb005522..65de1187640f5669553fb8e5946b2cfcca8dc607 100644
|
| --- a/media/base/fake_audio_render_callback.cc
|
| +++ b/media/base/fake_audio_render_callback.cc
|
| @@ -25,9 +25,22 @@ FakeAudioRenderCallback::~FakeAudioRenderCallback() {}
|
| int FakeAudioRenderCallback::Render(AudioBus* audio_bus,
|
| uint32_t frames_delayed,
|
| uint32_t frames_skipped) {
|
| + return RenderInternal(audio_bus, frames_delayed, volume_);
|
| +}
|
| +
|
| +double FakeAudioRenderCallback::ProvideInput(AudioBus* audio_bus,
|
| + uint32_t frames_delayed) {
|
| + // Volume should only be applied by the caller to ProvideInput, so don't bake
|
| + // it into the rendered audio.
|
| + RenderInternal(audio_bus, frames_delayed, 1.0);
|
| + return volume_;
|
| +}
|
| +
|
| +int FakeAudioRenderCallback::RenderInternal(AudioBus* audio_bus,
|
| + uint32_t frames_delayed,
|
| + double volume) {
|
| DCHECK_LE(frames_delayed, static_cast<uint32_t>(INT_MAX));
|
| last_frames_delayed_ = static_cast<int>(frames_delayed);
|
| -
|
| last_channel_count_ = audio_bus->channels();
|
|
|
| int number_of_frames = audio_bus->frames();
|
| @@ -36,21 +49,16 @@ int FakeAudioRenderCallback::Render(AudioBus* audio_bus,
|
|
|
| // Fill first channel with a sine wave.
|
| for (int i = 0; i < number_of_frames; ++i)
|
| - audio_bus->channel(0)[i] = sin(2 * M_PI * (x_ + step_ * i));
|
| + audio_bus->channel(0)[i] = sin(2 * M_PI * (x_ + step_ * i)) * volume;
|
| x_ += number_of_frames * step_;
|
|
|
| // Copy first channel into the rest of the channels.
|
| - for (int i = 1; i < audio_bus->channels(); ++i)
|
| + for (int i = 1; i < audio_bus->channels(); ++i) {
|
| memcpy(audio_bus->channel(i), audio_bus->channel(0),
|
| number_of_frames * sizeof(*audio_bus->channel(i)));
|
| + }
|
|
|
| return number_of_frames;
|
| }
|
|
|
| -double FakeAudioRenderCallback::ProvideInput(AudioBus* audio_bus,
|
| - uint32_t frames_delayed) {
|
| - Render(audio_bus, frames_delayed, 0);
|
| - return volume_;
|
| -}
|
| -
|
| } // namespace media
|
|
|