Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / media / base / fake_audio_renderer_sink.h
blob0a9bd93234ab4d4b1c88ad91069c694b6bb9e917
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_
6 #define MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_
8 #include <string>
10 #include "media/audio/audio_parameters.h"
11 #include "media/base/audio_renderer_sink.h"
13 namespace media {
15 class FakeOutputDevice;
17 class FakeAudioRendererSink : public AudioRendererSink {
18 public:
19 enum State {
20 kUninitialized,
21 kInitialized,
22 kStarted,
23 kPaused,
24 kPlaying,
25 kStopped
28 FakeAudioRendererSink();
30 void Initialize(const AudioParameters& params,
31 RenderCallback* callback) override;
32 void Start() override;
33 void Stop() override;
34 void Pause() override;
35 void Play() override;
36 bool SetVolume(double volume) override;
37 OutputDevice* GetOutputDevice() override;
39 // Attempts to call Render() on the callback provided to
40 // Initialize() with |dest| and |audio_delay_milliseconds|.
41 // Returns true and sets |frames_written| to the return value of the
42 // Render() call.
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
45 // value of |frames_written| is undefined if false is returned.
46 bool Render(AudioBus* dest, int audio_delay_milliseconds,
47 int* frames_written);
48 void OnRenderError();
50 State state() const { return state_; }
52 protected:
53 ~FakeAudioRendererSink() override;
55 private:
56 void ChangeState(State new_state);
58 State state_;
59 RenderCallback* callback_;
60 scoped_ptr<FakeOutputDevice> output_device_;
62 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink);
65 } // namespace media
67 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_