| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 bool SetVolume(double volume) override; | 36 bool SetVolume(double volume) override; |
| 37 OutputDevice* GetOutputDevice() override; | 37 OutputDevice* GetOutputDevice() override; |
| 38 | 38 |
| 39 // Attempts to call Render() on the callback provided to | 39 // Attempts to call Render() on the callback provided to |
| 40 // Initialize() with |dest| and |audio_delay_milliseconds|. | 40 // Initialize() with |dest| and |audio_delay_milliseconds|. |
| 41 // Returns true and sets |frames_written| to the return value of the | 41 // Returns true and sets |frames_written| to the return value of the |
| 42 // Render() call. | 42 // Render() call. |
| 43 // Returns false if this object is in a state where calling Render() | 43 // Returns false if this object is in a state where calling Render() |
| 44 // should not occur. (i.e., in the kPaused or kStopped state.) The | 44 // should not occur. (i.e., in the kPaused or kStopped state.) The |
| 45 // value of |frames_written| is undefined if false is returned. | 45 // value of |frames_written| is undefined if false is returned. |
| 46 bool Render(AudioBus* dest, | 46 bool Render(AudioBus* dest, int audio_delay_milliseconds, |
| 47 uint32_t audio_delay_milliseconds, | |
| 48 int* frames_written); | 47 int* frames_written); |
| 49 void OnRenderError(); | 48 void OnRenderError(); |
| 50 | 49 |
| 51 State state() const { return state_; } | 50 State state() const { return state_; } |
| 52 | 51 |
| 53 protected: | 52 protected: |
| 54 ~FakeAudioRendererSink() override; | 53 ~FakeAudioRendererSink() override; |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 void ChangeState(State new_state); | 56 void ChangeState(State new_state); |
| 58 | 57 |
| 59 State state_; | 58 State state_; |
| 60 RenderCallback* callback_; | 59 RenderCallback* callback_; |
| 61 scoped_ptr<FakeOutputDevice> output_device_; | 60 scoped_ptr<FakeOutputDevice> output_device_; |
| 62 | 61 |
| 63 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink); | 62 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink); |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 } // namespace media | 65 } // namespace media |
| 67 | 66 |
| 68 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ | 67 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_ |
| OLD | NEW |