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

Side by Side Diff: content/renderer/media/html_audio_element_capturer_source.h

Issue 1599533003: MediaCaptureFromElement: add support for audio captureStream(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: using refptr iso WeakPtr 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 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 CONTENT_RENDERER_MEDIA_HTML_AUDIO_ELEMENT_CAPTURER_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_HTML_AUDIO_ELEMENT_CAPTURER_SOURCE_H_
7
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/threading/thread_checker.h"
11 #include "content/common/content_export.h"
12 #include "content/renderer/media/media_stream_audio_source.h"
13
14 namespace blink {
15 class WebMediaPlayer;
16 } // namespace blink
17
18 namespace media {
19 class AudioBus;
20 class WebAudioSourceProviderImpl;
21 } // namespace media
22
23 namespace content {
24
25 // This class is a MediaStreamAudioSource that registers to the constructor-
26 // passed weak WebAudioSourceProviderImpl to receive a copy of the audio data
27 // intended for rendering. This copied data is received on OnAudioBus() and sent
28 // to all the registered Tracks.
29 class CONTENT_EXPORT HtmlAudioElementCapturerSource final
30 : NON_EXPORTED_BASE(public MediaStreamAudioSource) {
31 public:
32 static HtmlAudioElementCapturerSource*
33 CreateFromWebMediaPlayerImpl(blink::WebMediaPlayer* player);
34
35 explicit HtmlAudioElementCapturerSource(
36 media::WebAudioSourceProviderImpl* audio_source);
37 ~HtmlAudioElementCapturerSource() override;
38
39 private:
40 // MediaStreamAudioSource implementation.
41 bool EnsureSourceIsStarted() final;
42 void EnsureSourceIsStopped() final;
43
44 // To act as an WebAudioSourceProviderImpl::CopyAudioCB.
45 void OnAudioBus(std::unique_ptr<media::AudioBus> audio_bus,
46 uint32_t delay_milliseconds,
47 int sample_rate);
48
49 scoped_refptr<media::WebAudioSourceProviderImpl> audio_source_;
50
51 bool is_started_;
52 int last_sample_rate_;
53 int last_num_channels_;
54 int last_bus_frames_;
55
56 base::ThreadChecker thread_checker_;
57
58 DISALLOW_COPY_AND_ASSIGN(HtmlAudioElementCapturerSource);
59 };
60
61 } // namespace content
62
63 #endif // CONTENT_RENDERER_MEDIA_HTML_AUDIO_ELEMENT_CAPTURER_SOURCE_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/media/html_audio_element_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698