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

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: Nit Created 4 years, 6 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
« no previous file with comments | « media/audio/virtual_audio_output_stream_unittest.cc ('k') | media/audio/virtual_audio_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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.
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 "base/memory/weak_ptr.h"
11 #include "base/synchronization/lock.h"
12 #include "media/audio/audio_io.h"
13 #include "media/audio/audio_source_diverter.h"
14 #include "media/base/audio_converter.h"
15 #include "media/base/audio_shifter.h"
16
17 namespace base {
18 class SingleThreadTaskRunner;
19 }
20
21 namespace media {
22
23 class VirtualAudioInputStream;
24
25 // This class is an adapter between push model and pull model for audio stream.
26 // This class is thread safe.
27 // Audio provider calls OnData() to push audio data into this class.
28 // Audio consumer calls ProvideInput() to pull audio data.
29 class MEDIA_EXPORT VirtualAudioSink : public AudioPushSink,
30 public AudioConverter::InputCallback {
31 public:
32 typedef base::Callback<void(VirtualAudioSink* sink)> AfterCloseCallback;
33
34 // Construct an audio loopback pathway to the given |target| (not owned).
35 // |target| must outlive this instance.
36 VirtualAudioSink(const AudioParameters& param,
37 VirtualAudioInputStream* target,
38 const AfterCloseCallback& callback);
39 ~VirtualAudioSink() override;
40
41 // AudioPushSink
42 void Close() override;
43 void OnData(std::unique_ptr<AudioBus> source,
44 base::TimeTicks reference_time) override;
45
46 // AudioConverter::InputCallback
47 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override;
48
49 private:
50 void StoreData(AudioBus* source, base::TimeTicks reference_time);
51
52 const AudioParameters params_;
53 VirtualAudioInputStream* const target_;
54 AudioShifter shifter_;
55 base::Lock shifter_lock_;
56 AfterCloseCallback after_close_callback_;
57
58 DISALLOW_COPY_AND_ASSIGN(VirtualAudioSink);
59 };
60
61 } // namespace media
62
63 #endif // MEDIA_AUDIO_VIRTUAL_AUDIO_SINK_H_
OLDNEW
« no previous file with comments | « media/audio/virtual_audio_output_stream_unittest.cc ('k') | media/audio/virtual_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698