Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: media/audio/virtual_audio_sink.h

Issue 1897953003: Unmute Tab Audio For Desktop Share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot error Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
miu 2016/05/02 20:06:14 No "(c)" in copyright headers anymore.
qiangchen 2016/05/03 16:58:24 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_AUDIO_VIRTUAL_AUDIO_SINK_H_
6 #define MEDIA_AUDIO_VIRTUAL_AUDIO_SINK_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "media/audio/audio_io.h"
11 #include "media/base/audio_converter.h"
12 #include "media/base/audio_shifter.h"
13
14 namespace media {
15
16 class VirtualAudioInputStream;
17
18 class MEDIA_EXPORT AudioPushSink {
miu 2016/05/02 20:06:14 This AudioPushSink interface should probably be pl
qiangchen 2016/05/03 16:58:24 Done.
19 public:
20 virtual void OnData(const AudioBus& source,
21 base::TimeTicks reference_time) = 0;
22 virtual void Close() = 0;
23 };
24
25 // This class is an adapter between push model and pull model for audio stream.
26 // Audio provider calls OnData() to push audio data into this class.
27 // Audio consumer calls ProvideInput() to pull audio data.
28 class MEDIA_EXPORT VirtualAudioSink : public AudioPushSink,
29 public AudioConverter::InputCallback {
30 public:
31 typedef base::Callback<void(VirtualAudioSink* sink)> AfterCloseCallback;
32
33 // Construct an audio loopback pathway to the given |target| (not owned).
34 // |target| must outlive this instance.
35 VirtualAudioSink(AudioParameters param,
36 VirtualAudioInputStream* target,
37 AfterCloseCallback callback);
38 ~VirtualAudioSink() override;
39
40 // AudioPushSink
41 void Close() override;
42 void OnData(const AudioBus& source, base::TimeTicks reference_time) override;
43
44 // AudioConverter::InputCallback
45 double ProvideInput(AudioBus* audio_bus,
46 base::TimeDelta buffer_delay) override;
47
48 private:
49 AudioParameters params_;
miu 2016/05/02 20:06:14 Since these members should never change after init
qiangchen 2016/05/03 16:58:24 Done.
50 VirtualAudioInputStream* target_;
51 AudioShifter shifter_;
52 AfterCloseCallback after_close_callback_;
53 };
54
55 } // namespace media
56
57 #endif // MEDIA_AUDIO_VIRTUAL_AUDIO_SINK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698