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

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

Issue 1897953003: Unmute Tab Audio For Desktop Share (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittest 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ 5 #ifndef MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_
6 #define MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ 6 #define MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_
7 7
8 #include "base/time/time.h"
9 #include "media/base/audio_bus.h"
8 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
9 11
10 // Audio sources may optionally implement AudioSourceDiverter to temporarily 12 // Audio sources may optionally implement AudioSourceDiverter to temporarily
11 // divert audio data to an alternate AudioOutputStream. This allows the audio 13 // divert audio data to an alternate AudioOutputStream. This allows the audio
12 // data to be plumbed to an alternate consumer; for example, a loopback 14 // data to be plumbed to an alternate consumer; for example, a loopback
13 // mechanism for audio mirroring. 15 // mechanism for audio mirroring.
14 16
15 namespace media { 17 namespace media {
16 18
17 class AudioOutputStream; 19 class AudioOutputStream;
18 class AudioParameters; 20 class AudioParameters;
19 21
22 class MEDIA_EXPORT AudioPushSink {
23 public:
24 virtual void OnData(const AudioBus& source,
25 base::TimeTicks reference_time) = 0;
26 virtual void Close() = 0;
miu 2016/05/06 22:29:50 Please add a comment for Close() here (that it has
qiangchen 2016/05/10 22:36:53 Done.
27 };
28
20 class MEDIA_EXPORT AudioSourceDiverter { 29 class MEDIA_EXPORT AudioSourceDiverter {
21 public: 30 public:
22 // Returns the audio parameters of the divertable audio data. 31 // Returns the audio parameters of the divertable audio data.
23 virtual const AudioParameters& GetAudioParameters() = 0; 32 virtual const AudioParameters& GetAudioParameters() = 0;
24 33
25 // Start providing audio data to the given |to_stream|, which is in an 34 // Start providing audio data to the given |to_stream|, which is in an
26 // unopened state. |to_stream| remains under the control of the 35 // unopened state. |to_stream| remains under the control of the
27 // AudioSourceDiverter. 36 // AudioSourceDiverter.
28 virtual void StartDiverting(AudioOutputStream* to_stream) = 0; 37 virtual void StartDiverting(AudioOutputStream* to_stream) = 0;
29 38
30 // Stops diverting audio data to the stream. The AudioSourceDiverter is 39 // Stops diverting audio data to the stream. The AudioSourceDiverter is
31 // responsible for making sure the stream is closed, perhaps asynchronously. 40 // responsible for making sure the stream is closed, perhaps asynchronously.
32 virtual void StopDiverting() = 0; 41 virtual void StopDiverting() = 0;
33 42
34 protected: 43 // Start duplicating the current audio stream, and push the copied data into
44 // |sink|.
45 virtual void StartDuplicating(AudioPushSink* sink) = 0;
46
47 // Stop duplicating for the specified |sink|. The AudioSourceDiverter is
48 // responsible for making sure the stream is closed, perhaps asynchronously.
miu 2016/05/06 22:29:50 nit: s/stream is closed/sink is closed/
qiangchen 2016/05/10 22:36:53 Done.
49 virtual void StopDuplicating(AudioPushSink* sink) = 0;
50
51 protected:
35 virtual ~AudioSourceDiverter() {} 52 virtual ~AudioSourceDiverter() {}
36 }; 53 };
37 54
38 } // namespace media 55 } // namespace media
39 56
40 #endif // MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_ 57 #endif // MEDIA_AUDIO_AUDIO_SOURCE_DIVERTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698