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

Unified Diff: media/base/fake_audio_render_callback.cc

Issue 10823175: Switch AudioRenderSink::Callback to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gotta catch'em all! Created 8 years, 4 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/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 15986fd3c91e9c8fa1bcb43741464da0c041bb85..5364f7392f091162d60b1d566b1e6428c7b221b1 100644
--- a/media/base/fake_audio_render_callback.cc
+++ b/media/base/fake_audio_render_callback.cc
@@ -19,21 +19,20 @@ FakeAudioRenderCallback::FakeAudioRenderCallback(double step)
FakeAudioRenderCallback::~FakeAudioRenderCallback() {}
-int FakeAudioRenderCallback::Render(const std::vector<float*>& audio_data,
- int number_of_frames,
+int FakeAudioRenderCallback::Render(AudioBus* audio_bus, int number_of_frames,
int audio_delay_milliseconds) {
if (half_fill_)
number_of_frames /= 2;
// Fill first channel with a sine wave.
for (int i = 0; i < number_of_frames; ++i)
- audio_data[0][i] = sin(2 * M_PI * (x_ + step_ * i));
+ audio_bus->channel(0)[i] = sin(2 * M_PI * (x_ + step_ * i));
x_ += number_of_frames * step_;
// Copy first channel into the rest of the channels.
- for (size_t i = 1; i < audio_data.size(); ++i)
- memcpy(audio_data[i], audio_data[0],
- number_of_frames * sizeof(*audio_data[0]));
+ 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;
}

Powered by Google App Engine
This is Rietveld 408576698