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

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

Issue 883293005: Cast: Basic cast_receiver API for chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra BUILD.gn line Created 5 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Stops recording audio. This method will empty its track lists since 102 // Stops recording audio. This method will empty its track lists since
103 // stopping the capturer will implicitly invalidate all its tracks. 103 // stopping the capturer will implicitly invalidate all its tracks.
104 // This method is exposed to the public because the MediaStreamAudioSource can 104 // This method is exposed to the public because the MediaStreamAudioSource can
105 // call Stop() 105 // call Stop()
106 void Stop(); 106 void Stop();
107 107
108 // Returns the output format. 108 // Returns the output format.
109 // Called on the main render thread. 109 // Called on the main render thread.
110 media::AudioParameters GetOutputFormat() const; 110 media::AudioParameters GetOutputFormat() const;
111 111
112 // Used by the unittests to inject their own source to the capturer. 112 // Used by clients to inject their own source to the capturer.
113 void SetCapturerSourceForTesting( 113 void SetCapturerSource(
114 const scoped_refptr<media::AudioCapturerSource>& source, 114 const scoped_refptr<media::AudioCapturerSource>& source,
115 media::AudioParameters params); 115 media::AudioParameters params);
116 116
117 protected: 117 protected:
118 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; 118 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
119 ~WebRtcAudioCapturer() override; 119 ~WebRtcAudioCapturer() override;
120 120
121 private: 121 private:
122 class TrackOwner; 122 class TrackOwner;
123 typedef TaggedList<TrackOwner> TrackList; 123 typedef TaggedList<TrackOwner> TrackList;
124 124
125 WebRtcAudioCapturer(int render_view_id, 125 WebRtcAudioCapturer(int render_view_id,
126 const StreamDeviceInfo& device_info, 126 const StreamDeviceInfo& device_info,
127 const blink::WebMediaConstraints& constraints, 127 const blink::WebMediaConstraints& constraints,
128 WebRtcAudioDeviceImpl* audio_device, 128 WebRtcAudioDeviceImpl* audio_device,
129 MediaStreamAudioSource* audio_source); 129 MediaStreamAudioSource* audio_source);
130 130
131 // AudioCapturerSource::CaptureCallback implementation. 131 // AudioCapturerSource::CaptureCallback implementation.
132 // Called on the AudioInputDevice audio thread. 132 // Called on the AudioInputDevice audio thread.
133 void Capture(const media::AudioBus* audio_source, 133 void Capture(const media::AudioBus* audio_source,
134 int audio_delay_milliseconds, 134 int audio_delay_milliseconds,
135 double volume, 135 double volume,
136 bool key_pressed) override; 136 bool key_pressed) override;
137 void OnCaptureError() override; 137 void OnCaptureError() override;
138 138
139 // Initializes the default audio capturing source using the provided render 139 // Initializes the default audio capturing source using the provided render
140 // view id and device information. Return true if success, otherwise false. 140 // view id and device information. Return true if success, otherwise false.
141 bool Initialize(); 141 bool Initialize();
142 142
143 // SetCapturerSource() is called if the client on the source side desires to 143 // SetCapturerSourceInternal() is called if the client on the source side
144 // provide their own captured audio data. Client is responsible for calling 144 // desires to provide their own captured audio data. Client is responsible
145 // Start() on its own source to have the ball rolling. 145 // for calling Start() on its own source to get the ball rolling.
146 // Called on the main render thread. 146 // Called on the main render thread.
147 void SetCapturerSource( 147 void SetCapturerSourceInternal(
148 const scoped_refptr<media::AudioCapturerSource>& source, 148 const scoped_refptr<media::AudioCapturerSource>& source,
149 media::ChannelLayout channel_layout, 149 media::ChannelLayout channel_layout,
150 float sample_rate); 150 float sample_rate);
151 151
152 // Starts recording audio. 152 // Starts recording audio.
153 // Triggered by AddSink() on the main render thread or a Libjingle working 153 // Triggered by AddSink() on the main render thread or a Libjingle working
154 // thread. It should NOT be called under |lock_|. 154 // thread. It should NOT be called under |lock_|.
155 void Start(); 155 void Start();
156 156
157 // Helper function to get the buffer size based on |peer_connection_mode_| 157 // Helper function to get the buffer size based on |peer_connection_mode_|
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // guaranteed to exist as long as a WebRtcLocalAudioTrack is connected to this 206 // guaranteed to exist as long as a WebRtcLocalAudioTrack is connected to this
207 // WebRtcAudioCapturer. 207 // WebRtcAudioCapturer.
208 MediaStreamAudioSource* const audio_source_; 208 MediaStreamAudioSource* const audio_source_;
209 209
210 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); 210 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
211 }; 211 };
212 212
213 } // namespace content 213 } // namespace content
214 214
215 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ 215 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc/webrtc_video_capturer_adapter.h ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698