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

Unified Diff: media/base/fake_audio_render_callback.h

Issue 11410012: Collapse AudioRendererMixer and OnMoreDataResampler into AudioTransform. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename. Comments. Created 8 years, 1 month 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
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_render_callback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/fake_audio_render_callback.h
diff --git a/media/base/fake_audio_render_callback.h b/media/base/fake_audio_render_callback.h
index 760e39d6e9039c3fd40bf3aef74d206f6c8f9d1c..5318c99e851313ca998929ec52b236dbbf79fc33 100644
--- a/media/base/fake_audio_render_callback.h
+++ b/media/base/fake_audio_render_callback.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_
#define MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_
+#include "media/base/audio_converter.h"
#include "media/base/audio_renderer_sink.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -12,7 +13,10 @@ namespace media {
// Fake RenderCallback which will fill each request with a sine wave. Sine
// state is kept across callbacks. State can be reset to default via reset().
-class FakeAudioRenderCallback : public AudioRendererSink::RenderCallback {
+// Also provide an interface to AudioTransformInput.
+class FakeAudioRenderCallback
+ : public AudioRendererSink::RenderCallback,
+ public AudioConverter::InputCallback {
public:
// The function used to fulfill Render() is f(x) = sin(2 * PI * x * |step|),
// where x = [|number_of_frames| * m, |number_of_frames| * (m + 1)] and m =
@@ -22,9 +26,14 @@ class FakeAudioRenderCallback : public AudioRendererSink::RenderCallback {
// Renders a sine wave into the provided audio data buffer. If |half_fill_|
// is set, will only fill half the buffer.
- int Render(AudioBus* audio_bus, int audio_delay_milliseconds) OVERRIDE;
+ virtual int Render(AudioBus* audio_bus,
+ int audio_delay_milliseconds) OVERRIDE;
MOCK_METHOD0(OnRenderError, void());
+ // AudioTransform::ProvideAudioTransformInput implementation.
+ virtual double ProvideInput(AudioBus* audio_bus,
+ base::TimeDelta buffer_delay) OVERRIDE;
+
// Toggles only filling half the requested amount during Render().
void set_half_fill(bool half_fill) { half_fill_ = half_fill; }
@@ -35,11 +44,15 @@ class FakeAudioRenderCallback : public AudioRendererSink::RenderCallback {
// no Render() call occurred.
int last_audio_delay_milliseconds() { return last_audio_delay_milliseconds_; }
+ // Set volume information used by ProvideAudioTransformInput().
+ void set_volume(double volume) { volume_ = volume; }
+
private:
bool half_fill_;
double x_;
double step_;
int last_audio_delay_milliseconds_;
+ double volume_;
DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback);
};
« no previous file with comments | « media/base/audio_renderer_mixer_unittest.cc ('k') | media/base/fake_audio_render_callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698