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_
10 #include "media/audio/audio_parameters.h"
11 #include "media/base/audio_renderer_sink.h"
15 class FakeAudioRendererSink
: public AudioRendererSink
{
26 FakeAudioRendererSink();
28 void Initialize(const AudioParameters
& params
,
29 RenderCallback
* callback
) override
;
30 void Start() override
;
32 void Pause() override
;
34 bool SetVolume(double volume
) override
;
35 void SwitchOutputDevice(const std::string
& device_id
,
36 const GURL
& security_origin
,
37 const SwitchOutputDeviceCB
& callback
) 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
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
,
50 State
state() const { return state_
; }
53 ~FakeAudioRendererSink() override
;
56 void ChangeState(State new_state
);
59 RenderCallback
* callback_
;
61 DISALLOW_COPY_AND_ASSIGN(FakeAudioRendererSink
);
66 #endif // MEDIA_BASE_FAKE_AUDIO_RENDERER_SINK_H_