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(AudioBus* audio_bus, | 32 int Render(base::TimeDelta delay, |
33 uint32_t frames_delayed, | 33 base::TimeTicks delay_timestamp, |
34 uint32_t frames_skipped) override; | 34 int prior_frames_skipped, |
| 35 AudioBus* audio_bus) override; |
35 MOCK_METHOD0(OnRenderError, void()); | 36 MOCK_METHOD0(OnRenderError, void()); |
36 | 37 |
37 // AudioTransform::ProvideAudioTransformInput implementation. | 38 // AudioTransform::ProvideAudioTransformInput implementation. |
38 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; | 39 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; |
39 | 40 |
40 // Toggles only filling half the requested amount during Render(). | 41 // Toggles only filling half the requested amount during Render(). |
41 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } | 42 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } |
42 | 43 |
43 // Reset the sine state to initial value. | 44 // Reset the sine state to initial value. |
44 void reset() { x_ = 0; } | 45 void reset() { x_ = 0; } |
(...skipping 18 matching lines...) Expand all Loading... |
63 int last_frames_delayed_; | 64 int last_frames_delayed_; |
64 int last_channel_count_; | 65 int last_channel_count_; |
65 double volume_; | 66 double volume_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); | 68 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); |
68 }; | 69 }; |
69 | 70 |
70 } // namespace media | 71 } // namespace media |
71 | 72 |
72 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 73 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
OLD | NEW |