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

Unified Diff: media/base/fake_audio_render_callback.cc

Issue 2365723003: Break out WebAudio suspension code into new class. Add tests. (Closed)
Patch Set: Created 4 years, 3 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
« content/renderer/media/webaudio_suspender.cc ('K') | « content/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fc967c74fbd75bbb93fdbcd14f043598727984aa 100644
--- a/media/base/fake_audio_render_callback.cc
+++ b/media/base/fake_audio_render_callback.cc
@@ -36,13 +36,14 @@ 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;
}
« content/renderer/media/webaudio_suspender.cc ('K') | « content/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698