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

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

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

Powered by Google App Engine
This is Rietveld 408576698