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

Unified Diff: media/base/fake_audio_render_callback.h

Issue 10698066: Switch to pcm_low_latency and enable resampling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 8 years, 5 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.h
diff --git a/media/base/fake_audio_render_callback.h b/media/base/fake_audio_render_callback.h
index f80c9429457f5a8d29d5ee36023720b22d6579af..917e3c619d963df007588fd64cdcbfdc9d227c99 100644
--- a/media/base/fake_audio_render_callback.h
+++ b/media/base/fake_audio_render_callback.h
@@ -7,19 +7,19 @@
#include <vector>
-#include "base/time.h"
#include "media/base/audio_renderer_sink.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace media {
+// Fake RenderCallback which will fill each request with a sine wave. Sine
+// state is kept across callbacks.
class FakeAudioRenderCallback : public AudioRendererSink::RenderCallback {
public:
- // Initializes |fill_value_| to a random value seeded by current time.
- explicit FakeAudioRenderCallback(const AudioParameters& params);
+ explicit FakeAudioRenderCallback(double step);
scherkus (not reviewing) 2012/07/12 23:02:52 docs for step
DaleCurtis 2012/07/13 00:01:25 Done.
virtual ~FakeAudioRenderCallback();
- // Renders |fill_value_| into the provided audio data buffer. If |half_fill_|
+ // Renders a sine wave into the provided audio data buffer. If |half_fill_|
// is set, will only fill half the buffer.
int Render(const std::vector<float*>& audio_data, int number_of_frames,
int audio_delay_milliseconds) OVERRIDE;
@@ -28,17 +28,13 @@ class FakeAudioRenderCallback : public AudioRendererSink::RenderCallback {
// Toggles only filling half the requested amount during Render().
void set_half_fill(bool half_fill) { half_fill_ = half_fill; }
- float fill_value() { return fill_value_; }
-
- // Generates a fill value between [-1, 1). NextFillValue() is deterministic
- // based on fill_value_. Which means it will generate the same sequence of
- // fill values every time unless |fill_value_| is set using set_fill_value().
- void NextFillValue();
+ // Reset the sine state to initial value.
+ void reset() { x_ = 0; }
private:
bool half_fill_;
- float fill_value_;
- AudioParameters audio_parameters_;
+ double x_;
+ double step_;
DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback);
};

Powered by Google App Engine
This is Rietveld 408576698