| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // consuming audio for capture. |session_id| is passed to the browser to | 48 // consuming audio for capture. |session_id| is passed to the browser to |
| 49 // decide which device to use. |device_id| is used to identify which device | 49 // decide which device to use. |device_id| is used to identify which device |
| 50 // the capturer is created for. Called on the main render thread. | 50 // the capturer is created for. Called on the main render thread. |
| 51 bool Initialize(int render_view_id, | 51 bool Initialize(int render_view_id, |
| 52 media::ChannelLayout channel_layout, | 52 media::ChannelLayout channel_layout, |
| 53 int sample_rate, | 53 int sample_rate, |
| 54 int buffer_size, | 54 int buffer_size, |
| 55 int session_id, | 55 int session_id, |
| 56 const std::string& device_id, | 56 const std::string& device_id, |
| 57 int paired_output_sample_rate, | 57 int paired_output_sample_rate, |
| 58 int paired_output_frames_per_buffer); | 58 int paired_output_frames_per_buffer, |
| 59 bool use_platform_aec); |
| 59 | 60 |
| 60 // Add a audio track to the sinks of the capturer. | 61 // Add a audio track to the sinks of the capturer. |
| 61 // WebRtcAudioDeviceImpl calls this method on the main render thread but | 62 // WebRtcAudioDeviceImpl calls this method on the main render thread but |
| 62 // other clients may call it from other threads. The current implementation | 63 // other clients may call it from other threads. The current implementation |
| 63 // does not support multi-thread calling. | 64 // does not support multi-thread calling. |
| 64 // The first AddTrack will implicitly trigger the Start() of this object. | 65 // The first AddTrack will implicitly trigger the Start() of this object. |
| 65 // Called on the main render thread or libjingle working thread. | 66 // Called on the main render thread or libjingle working thread. |
| 66 void AddTrack(WebRtcLocalAudioTrack* track); | 67 void AddTrack(WebRtcLocalAudioTrack* track); |
| 67 | 68 |
| 68 // Remove a audio track from the sinks of the capturer. | 69 // Remove a audio track from the sinks of the capturer. |
| 69 // If the track has been added to the capturer, it must call RemoveTrack() | 70 // If the track has been added to the capturer, it must call RemoveTrack() |
| 70 // before it goes away. | 71 // before it goes away. |
| 71 // Called on the main render thread or libjingle working thread. | 72 // Called on the main render thread or libjingle working thread. |
| 72 void RemoveTrack(WebRtcLocalAudioTrack* track); | 73 void RemoveTrack(WebRtcLocalAudioTrack* track); |
| 73 | 74 |
| 74 // SetCapturerSource() is called if the client on the source side desires to | 75 // SetCapturerSource() is called if the client on the source side desires to |
| 75 // provide their own captured audio data. Client is responsible for calling | 76 // provide their own captured audio data. Client is responsible for calling |
| 76 // Start() on its own source to have the ball rolling. | 77 // Start() on its own source to have the ball rolling. |
| 77 // Called on the main render thread. | 78 // Called on the main render thread. |
| 78 void SetCapturerSource( | 79 void SetCapturerSource( |
| 79 const scoped_refptr<media::AudioCapturerSource>& source, | 80 const scoped_refptr<media::AudioCapturerSource>& source, |
| 80 media::ChannelLayout channel_layout, | 81 media::ChannelLayout channel_layout, |
| 81 float sample_rate); | 82 float sample_rate, |
| 83 bool use_platform_aec); |
| 82 | 84 |
| 83 // Called when a stream is connecting to a peer connection. This will set | 85 // Called when a stream is connecting to a peer connection. This will set |
| 84 // up the native buffer size for the stream in order to optimize the | 86 // up the native buffer size for the stream in order to optimize the |
| 85 // performance for peer connection. | 87 // performance for peer connection. |
| 86 void EnablePeerConnectionMode(); | 88 void EnablePeerConnectionMode(); |
| 87 | 89 |
| 88 // Volume APIs used by WebRtcAudioDeviceImpl. | 90 // Volume APIs used by WebRtcAudioDeviceImpl. |
| 89 // Called on the AudioInputDevice audio thread. | 91 // Called on the AudioInputDevice audio thread. |
| 90 void SetVolume(int volume); | 92 void SetVolume(int volume); |
| 91 int Volume() const; | 93 int Volume() const; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // AudioCapturerSource::CaptureCallback implementation. | 136 // AudioCapturerSource::CaptureCallback implementation. |
| 135 // Called on the AudioInputDevice audio thread. | 137 // Called on the AudioInputDevice audio thread. |
| 136 virtual void Capture(media::AudioBus* audio_source, | 138 virtual void Capture(media::AudioBus* audio_source, |
| 137 int audio_delay_milliseconds, | 139 int audio_delay_milliseconds, |
| 138 double volume, | 140 double volume, |
| 139 bool key_pressed) OVERRIDE; | 141 bool key_pressed) OVERRIDE; |
| 140 virtual void OnCaptureError() OVERRIDE; | 142 virtual void OnCaptureError() OVERRIDE; |
| 141 | 143 |
| 142 // Reconfigures the capturer with a new capture parameters. | 144 // Reconfigures the capturer with a new capture parameters. |
| 143 // Must be called without holding the lock. | 145 // Must be called without holding the lock. |
| 144 void Reconfigure(int sample_rate, media::ChannelLayout channel_layout); | 146 void Reconfigure(int sample_rate, media::ChannelLayout channel_layout, |
| 147 bool use_platform_aec); |
| 145 | 148 |
| 146 // Starts recording audio. | 149 // Starts recording audio. |
| 147 // 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 |
| 148 // thread. It should NOT be called under |lock_|. | 151 // thread. It should NOT be called under |lock_|. |
| 149 void Start(); | 152 void Start(); |
| 150 | 153 |
| 151 // 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_| |
| 152 // and sample rate; | 155 // and sample rate; |
| 153 int GetBufferSize(int sample_rate) const; | 156 int GetBufferSize(int sample_rate) const; |
| 154 | 157 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // Cache value for the audio processing params. | 203 // Cache value for the audio processing params. |
| 201 base::TimeDelta audio_delay_; | 204 base::TimeDelta audio_delay_; |
| 202 bool key_pressed_; | 205 bool key_pressed_; |
| 203 | 206 |
| 204 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); | 207 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); |
| 205 }; | 208 }; |
| 206 | 209 |
| 207 } // namespace content | 210 } // namespace content |
| 208 | 211 |
| 209 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ | 212 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ |
| OLD | NEW |