-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio_output_delegate_impl.h
66 lines (52 loc) · 2.01 KB
/
audio_output_delegate_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
//
#ifndef CHROMIUM_MEDIA_LIB_AUDIO_OUTPUT_DELEGATE_IMPL_H_
#define CHROMIUM_MEDIA_LIB_AUDIO_OUTPUT_DELEGATE_IMPL_H_
#include <memory>
#include <string>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
#include "media/audio/audio_output_delegate.h"
#include "media/base/media_export.h"
namespace media {
class AudioLog;
class AudioManager;
class AudioOutputController;
class AudioParameters;
class AudioSyncReader;
class MEDIA_EXPORT AudioOutputDelegateImpl : public AudioOutputDelegate {
public:
AudioOutputDelegateImpl(EventHandler* handler,
AudioManager* audio_manager,
std::unique_ptr<AudioLog> audio_log,
int stream_id,
int render_frame_id,
const AudioParameters& params,
const std::string& output_device_id,
base::SingleThreadTaskRunner* io_task_runner);
~AudioOutputDelegateImpl() override;
// AudioOutputDelegate implementation.
int GetStreamId() const override;
void OnPlayStream() override;
void OnPauseStream() override;
void OnSetVolume(double volume) override;
private:
class ControllerEventHandler;
void SendCreatedNotification();
void OnError();
void UpdatePlayingState(bool playing);
EventHandler* subscriber_;
std::unique_ptr<AudioLog> const audio_log_;
std::unique_ptr<ControllerEventHandler> controller_event_handler_;
std::unique_ptr<AudioSyncReader> reader_;
scoped_refptr<AudioOutputController> controller_;
const int stream_id_;
base::SingleThreadTaskRunner* const io_task_runner_;
bool playing_ = false;
base::WeakPtrFactory<AudioOutputDelegateImpl> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AudioOutputDelegateImpl);
};
} // namespace media
#endif // CHROMIUM_MEDIA_LIB_AUDIO_OUTPUT_DELEGATE_IMPL_H_