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"
13 class FakeAudioRendererSink
: public AudioRendererSink
{
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
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
,
45 State
state() const { return state_
; }
48 virtual ~FakeAudioRendererSink();
51 void ChangeState(State new_state
);
54 RenderCallback
* callback_
;
56 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink
);
61 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_