Clean-up: Removes gfx::FontList::GetStringWidth(text).
[chromium-blink-merge.git] / media / base / fake_audio_renderer_sink.h
blobb548224e6cc6eb60c5f42e66ee5f8926983326e0
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 "media/audio/audio_parameters.h"
9 #include "media/base/audio_renderer_sink.h"
11 namespace media {
13 class FakeAudioRendererSink : public AudioRendererSink {
14 public:
15 enum State {
16 kUninitialized,
17 kInitialized,
18 kStarted,
19 kPaused,
20 kPlaying,
21 kStopped
24 FakeAudioRendererSink();
26 virtual void Initialize(const AudioParameters& params,
27 RenderCallback* callback) OVERRIDE;
28 virtual void Start() OVERRIDE;
29 virtual void Stop() OVERRIDE;
30 virtual void Pause() OVERRIDE;
31 virtual void Play() OVERRIDE;
32 virtual bool SetVolume(double volume) OVERRIDE;
34 // Attempts to call Render() on the callback provided to
35 // Initialize() with |dest| and |audio_delay_milliseconds|.
36 // Returns true and sets |frames_written| to the return value of the
37 // Render() call.
38 // Returns false if this object is in a state where calling Render()
39 // should not occur. (i.e., in the kPaused or kStopped state.) The
40 // value of |frames_written| is undefined if false is returned.
41 bool Render(AudioBus* dest, int audio_delay_milliseconds,
42 int* frames_written);
43 void OnRenderError();
45 State state() const { return state_; }
47 protected:
48 virtual ~FakeAudioRendererSink();
50 private:
51 void ChangeState(State new_state);
53 State state_;
54 RenderCallback* callback_;
56 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink);
59 } // namespace media
61 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_