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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // up the native buffer size for the stream in order to optimize the | 75 // up the native buffer size for the stream in order to optimize the |
76 // performance for peer connection. | 76 // performance for peer connection. |
77 void EnablePeerConnectionMode(); | 77 void EnablePeerConnectionMode(); |
78 | 78 |
79 // Volume APIs used by WebRtcAudioDeviceImpl. | 79 // Volume APIs used by WebRtcAudioDeviceImpl. |
80 // Called on the AudioInputDevice audio thread. | 80 // Called on the AudioInputDevice audio thread. |
81 void SetVolume(int volume); | 81 void SetVolume(int volume); |
82 int Volume() const; | 82 int Volume() const; |
83 int MaxVolume() const; | 83 int MaxVolume() const; |
84 | 84 |
85 | |
86 // Audio parameters utilized by the source of the audio capturer. | 85 // Audio parameters utilized by the source of the audio capturer. |
87 // TODO(phoglund): Think over the implications of this accessor and if we can | 86 // TODO(phoglund): Think over the implications of this accessor and if we can |
88 // remove it. | 87 // remove it. |
89 media::AudioParameters source_audio_parameters() const; | 88 media::AudioParameters source_audio_parameters() const; |
90 | 89 |
91 // Gets information about the paired output device. Returns true if such a | 90 // Gets information about the paired output device. Returns true if such a |
92 // device exists. | 91 // device exists. |
93 bool GetPairedOutputParameters(int* session_id, | 92 bool GetPairedOutputParameters(int* session_id, |
94 int* output_sample_rate, | 93 int* output_sample_rate, |
95 int* output_frames_per_buffer) const; | 94 int* output_frames_per_buffer) const; |
96 | 95 |
97 const std::string& device_id() const { return device_info_.device.id; } | 96 const std::string& device_id() const { return device_info_.device.id; } |
98 int session_id() const { return device_info_.session_id; } | 97 int session_id() const { return device_info_.session_id; } |
99 | 98 |
100 // Stops recording audio. This method will empty its track lists since | 99 // Stops recording audio. This method will empty its track lists since |
101 // stopping the capturer will implicitly invalidate all its tracks. | 100 // stopping the capturer will implicitly invalidate all its tracks. |
102 // This method is exposed to the public because the media stream track can | 101 // This method is exposed to the public because the media stream track can |
103 // call Stop() on its source. | 102 // call Stop() on its source. |
104 void Stop(); | 103 void Stop(); |
105 | 104 |
106 // Called by the WebAudioCapturerSource to get the audio processing params. | 105 // Called by the WebAudioCapturerSource to get the audio processing params. |
107 // This function is triggered by provideInput() on the WebAudio audio thread, | 106 // This function is triggered by provideInput() on the WebAudio audio thread, |
108 // TODO(xians): Remove after moving APM from WebRtc to Chrome. | 107 // TODO(xians): Remove after moving APM from WebRtc to Chrome. |
109 void GetAudioProcessingParams(base::TimeDelta* delay, int* volume, | 108 void GetAudioProcessingParams(base::TimeDelta* delay, int* volume, |
110 bool* key_pressed); | 109 bool* key_pressed); |
111 | 110 |
112 // Called by the WebRtcAudioDeviceImpl to push the render audio to | |
113 // audio processor for echo cancellation analysis. | |
114 void FeedRenderDataToAudioProcessor(const int16* render_audio, | |
115 int sample_rate, | |
116 int number_of_channels, | |
117 int number_of_frames, | |
118 base::TimeDelta render_delay); | |
119 | |
120 // Use by the unittests to inject their own source to the capturer. | 111 // Use by the unittests to inject their own source to the capturer. |
121 void SetCapturerSourceForTesting( | 112 void SetCapturerSourceForTesting( |
122 const scoped_refptr<media::AudioCapturerSource>& source, | 113 const scoped_refptr<media::AudioCapturerSource>& source, |
123 media::AudioParameters params); | 114 media::AudioParameters params); |
124 | 115 |
125 protected: | 116 protected: |
126 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; | 117 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; |
127 virtual ~WebRtcAudioCapturer(); | 118 virtual ~WebRtcAudioCapturer(); |
128 | 119 |
129 private: | 120 private: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Raw pointer to the WebRtcAudioDeviceImpl, which is valid for the lifetime | 204 // Raw pointer to the WebRtcAudioDeviceImpl, which is valid for the lifetime |
214 // of RenderThread. | 205 // of RenderThread. |
215 WebRtcAudioDeviceImpl* audio_device_; | 206 WebRtcAudioDeviceImpl* audio_device_; |
216 | 207 |
217 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); | 208 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); |
218 }; | 209 }; |
219 | 210 |
220 } // namespace content | 211 } // namespace content |
221 | 212 |
222 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 213 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
OLD | NEW |