BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / media / base / audio_renderer_mixer_input.h
blobf2b8c3e0b3c67b2014c5fc76225e8e6a45f2de25
1 // Copyright (c) 2012 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_AUDIO_RENDERER_MIXER_INPUT_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback.h"
12 #include "media/base/audio_converter.h"
13 #include "media/base/audio_renderer_sink.h"
15 namespace media {
17 class AudioRendererMixer;
19 class MEDIA_EXPORT AudioRendererMixerInput
20 : NON_EXPORTED_BASE(public AudioRendererSink),
21 public AudioConverter::InputCallback {
22 public:
23 typedef base::Callback<AudioRendererMixer*(
24 const AudioParameters& params)> GetMixerCB;
25 typedef base::Callback<void(const AudioParameters& params)> RemoveMixerCB;
27 AudioRendererMixerInput(
28 const GetMixerCB& get_mixer_cb, const RemoveMixerCB& remove_mixer_cb);
30 // AudioRendererSink implementation.
31 void Start() override;
32 void Stop() override;
33 void Play() override;
34 void Pause() override;
35 bool SetVolume(double volume) override;
36 OutputDevice* GetOutputDevice() override;
37 void Initialize(const AudioParameters& params,
38 AudioRendererSink::RenderCallback* renderer) override;
40 // Called by AudioRendererMixer when an error occurs.
41 void OnRenderError();
43 protected:
44 ~AudioRendererMixerInput() override;
46 private:
47 friend class AudioRendererMixerInputTest;
49 bool playing_;
50 bool initialized_;
51 double volume_;
53 // AudioConverter::InputCallback implementation.
54 double ProvideInput(AudioBus* audio_bus,
55 base::TimeDelta buffer_delay) override;
57 // Callbacks provided during construction which allow AudioRendererMixerInput
58 // to retrieve a mixer during Initialize() and notify when it's done with it.
59 GetMixerCB get_mixer_cb_;
60 RemoveMixerCB remove_mixer_cb_;
62 // AudioParameters received during Initialize().
63 AudioParameters params_;
65 // AudioRendererMixer provided through |get_mixer_cb_| during Initialize(),
66 // guaranteed to live (at least) until |remove_mixer_cb_| is called.
67 AudioRendererMixer* mixer_;
69 // Source of audio data which is provided to the mixer.
70 AudioRendererSink::RenderCallback* callback_;
72 // Error callback for handing to AudioRendererMixer.
73 const base::Closure error_cb_;
75 DISALLOW_COPY_AND_ASSIGN(AudioRendererMixerInput);
78 } // namespace media
80 #endif // MEDIA_BASE_AUDIO_RENDERER_MIXER_INPUT_H_