OLD | NEW |
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void OnCaptureError() override; | 132 void OnCaptureError() override; |
133 | 133 |
134 // Initializes the default audio capturing source using the provided render | 134 // Initializes the default audio capturing source using the provided render |
135 // frame id and device information. Return true if success, otherwise false. | 135 // frame id and device information. Return true if success, otherwise false. |
136 bool Initialize(); | 136 bool Initialize(); |
137 | 137 |
138 // SetCapturerSourceInternal() is called if the client on the source side | 138 // SetCapturerSourceInternal() is called if the client on the source side |
139 // desires to provide their own captured audio data. Client is responsible | 139 // desires to provide their own captured audio data. Client is responsible |
140 // for calling Start() on its own source to get the ball rolling. | 140 // for calling Start() on its own source to get the ball rolling. |
141 // Called on the main render thread. | 141 // Called on the main render thread. |
| 142 // buffer_size is optional. Set to 0 to let it be chosen automatically. |
142 void SetCapturerSourceInternal( | 143 void SetCapturerSourceInternal( |
143 const scoped_refptr<media::AudioCapturerSource>& source, | 144 const scoped_refptr<media::AudioCapturerSource>& source, |
144 media::ChannelLayout channel_layout, | 145 media::ChannelLayout channel_layout, |
145 float sample_rate); | 146 int sample_rate, |
| 147 int buffer_size); |
146 | 148 |
147 // Starts recording audio. | 149 // Starts recording audio. |
148 // Triggered by AddSink() on the main render thread or a Libjingle working | 150 // Triggered by AddSink() on the main render thread or a Libjingle working |
149 // thread. It should NOT be called under |lock_|. | 151 // thread. It should NOT be called under |lock_|. |
150 void Start(); | 152 void Start(); |
151 | 153 |
152 // Helper function to get the buffer size based on |peer_connection_mode_| | 154 // Helper function to get the buffer size based on |peer_connection_mode_| |
153 // and sample rate; | 155 // and sample rate; |
154 int GetBufferSize(int sample_rate) const; | 156 int GetBufferSize(int sample_rate) const; |
155 | 157 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // guaranteed to exist as long as a WebRtcLocalAudioTrack is connected to this | 203 // guaranteed to exist as long as a WebRtcLocalAudioTrack is connected to this |
202 // WebRtcAudioCapturer. | 204 // WebRtcAudioCapturer. |
203 MediaStreamAudioSource* const audio_source_; | 205 MediaStreamAudioSource* const audio_source_; |
204 | 206 |
205 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); | 207 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); |
206 }; | 208 }; |
207 | 209 |
208 } // namespace content | 210 } // namespace content |
209 | 211 |
210 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 212 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
OLD | NEW |