OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
6 #define MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 6 #define MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public AudioConverter::InputCallback { | 22 public AudioConverter::InputCallback { |
23 public: | 23 public: |
24 // The function used to fulfill Render() is f(x) = sin(2 * PI * x * |step|), | 24 // The function used to fulfill Render() is f(x) = sin(2 * PI * x * |step|), |
25 // where x = [|number_of_frames| * m, |number_of_frames| * (m + 1)] and m = | 25 // where x = [|number_of_frames| * m, |number_of_frames| * (m + 1)] and m = |
26 // the number of Render() calls fulfilled thus far. | 26 // the number of Render() calls fulfilled thus far. |
27 explicit FakeAudioRenderCallback(double step); | 27 explicit FakeAudioRenderCallback(double step); |
28 ~FakeAudioRenderCallback() override; | 28 ~FakeAudioRenderCallback() override; |
29 | 29 |
30 // Renders a sine wave into the provided audio data buffer. If |half_fill_| | 30 // Renders a sine wave into the provided audio data buffer. If |half_fill_| |
31 // is set, will only fill half the buffer. | 31 // is set, will only fill half the buffer. |
32 int Render(base::TimeDelta delay, | 32 int Render(AudioBus* audio_bus, |
33 base::TimeTicks delay_timestamp, | 33 uint32_t frames_delayed, |
34 int prior_frames_skipped, | 34 uint32_t frames_skipped) override; |
35 AudioBus* audio_bus) override; | |
36 MOCK_METHOD0(OnRenderError, void()); | 35 MOCK_METHOD0(OnRenderError, void()); |
37 | 36 |
38 // AudioTransform::ProvideAudioTransformInput implementation. | 37 // AudioTransform::ProvideAudioTransformInput implementation. |
39 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; | 38 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; |
40 | 39 |
41 // Toggles only filling half the requested amount during Render(). | 40 // Toggles only filling half the requested amount during Render(). |
42 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } | 41 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } |
43 | 42 |
44 // Reset the sine state to initial value. | 43 // Reset the sine state to initial value. |
45 void reset() { x_ = 0; } | 44 void reset() { x_ = 0; } |
(...skipping 18 matching lines...) Expand all Loading... |
64 int last_frames_delayed_; | 63 int last_frames_delayed_; |
65 int last_channel_count_; | 64 int last_channel_count_; |
66 double volume_; | 65 double volume_; |
67 | 66 |
68 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); | 67 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); |
69 }; | 68 }; |
70 | 69 |
71 } // namespace media | 70 } // namespace media |
72 | 71 |
73 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 72 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
OLD | NEW |