OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_RENDERER_SINK_H_ | 5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ |
6 #define MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ | 6 #define MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 21 matching lines...) Expand all Loading... |
32 void Initialize(const AudioParameters& params, | 32 void Initialize(const AudioParameters& params, |
33 RenderCallback* callback) override; | 33 RenderCallback* callback) override; |
34 void Start() override; | 34 void Start() override; |
35 void Stop() override; | 35 void Stop() override; |
36 void Pause() override; | 36 void Pause() override; |
37 void Play() override; | 37 void Play() override; |
38 bool SetVolume(double volume) override; | 38 bool SetVolume(double volume) override; |
39 OutputDeviceInfo GetOutputDeviceInfo() override; | 39 OutputDeviceInfo GetOutputDeviceInfo() override; |
40 | 40 |
41 // Attempts to call Render() on the callback provided to | 41 // Attempts to call Render() on the callback provided to |
42 // Initialize() with |dest| and |audio_delay_milliseconds|. | 42 // Initialize() with |dest| and |frames_delayed|. |
43 // Returns true and sets |frames_written| to the return value of the | 43 // Returns true and sets |frames_written| to the return value of the |
44 // Render() call. | 44 // Render() call. |
45 // Returns false if this object is in a state where calling Render() | 45 // Returns false if this object is in a state where calling Render() |
46 // should not occur. (i.e., in the kPaused or kStopped state.) The | 46 // should not occur. (i.e., in the kPaused or kStopped state.) The |
47 // value of |frames_written| is undefined if false is returned. | 47 // value of |frames_written| is undefined if false is returned. |
48 bool Render(AudioBus* dest, | 48 bool Render(AudioBus* dest, uint32_t frames_delayed, int* frames_written); |
49 uint32_t audio_delay_milliseconds, | |
50 int* frames_written); | |
51 void OnRenderError(); | 49 void OnRenderError(); |
52 | 50 |
53 State state() const { return state_; } | 51 State state() const { return state_; } |
54 | 52 |
55 protected: | 53 protected: |
56 ~FakeAudioRendererSink() override; | 54 ~FakeAudioRendererSink() override; |
57 | 55 |
58 private: | 56 private: |
59 void ChangeState(State new_state); | 57 void ChangeState(State new_state); |
60 | 58 |
61 State state_; | 59 State state_; |
62 RenderCallback* callback_; | 60 RenderCallback* callback_; |
63 OutputDeviceInfo output_device_info_; | 61 OutputDeviceInfo output_device_info_; |
64 | 62 |
65 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink); | 63 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink); |
66 }; | 64 }; |
67 | 65 |
68 } // namespace media | 66 } // namespace media |
69 | 67 |
70 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ | 68 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |