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

Unified Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 99033003: Enable platform echo cancellation through the AudioRecord path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add PlatformEffects, unittests and clean up. 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc_audio_capturer.cc
diff --git a/content/renderer/media/webrtc_audio_capturer.cc b/content/renderer/media/webrtc_audio_capturer.cc
index 822c13aea90d8552fdcddb93c49a78c9e2822976..f252fedd8273168e80a8bca59a0bae6195aea4de 100644
--- a/content/renderer/media/webrtc_audio_capturer.cc
+++ b/content/renderer/media/webrtc_audio_capturer.cc
@@ -104,7 +104,8 @@ scoped_refptr<WebRtcAudioCapturer> WebRtcAudioCapturer::CreateCapturer() {
}
void WebRtcAudioCapturer::Reconfigure(int sample_rate,
- media::ChannelLayout channel_layout) {
+ media::ChannelLayout channel_layout,
+ const media::AudioParameters::PlatformEffects& effects) {
DCHECK(thread_checker_.CalledOnValidThread());
int buffer_size = GetBufferSize(sample_rate);
DVLOG(1) << "Using WebRTC input buffer size: " << buffer_size;
@@ -116,7 +117,7 @@ void WebRtcAudioCapturer::Reconfigure(int sample_rate,
int bits_per_sample = 16;
media::AudioParameters params(format, channel_layout, sample_rate,
bits_per_sample, buffer_size);
-
+ params.SetPlatformEffects(effects);
{
base::AutoLock auto_lock(lock_);
params_ = params;
@@ -128,13 +129,14 @@ void WebRtcAudioCapturer::Reconfigure(int sample_rate,
}
bool WebRtcAudioCapturer::Initialize(int render_view_id,
tommi (sloooow) - chröme 2013/12/11 12:14:36 nit: move render_view_id on a new line as well
- media::ChannelLayout channel_layout,
- int sample_rate,
- int buffer_size,
- int session_id,
- const std::string& device_id,
- int paired_output_sample_rate,
- int paired_output_frames_per_buffer) {
+ media::ChannelLayout channel_layout,
+ int sample_rate,
+ int buffer_size,
+ int session_id,
+ const std::string& device_id,
+ int paired_output_sample_rate,
+ int paired_output_frames_per_buffer,
+ const media::AudioParameters::PlatformEffects& effects) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "WebRtcAudioCapturer::Initialize()";
@@ -200,7 +202,8 @@ bool WebRtcAudioCapturer::Initialize(int render_view_id,
// providing an alternative media::AudioCapturerSource.
SetCapturerSource(AudioDeviceFactory::NewInputDevice(render_view_id),
channel_layout,
- static_cast<float>(sample_rate));
+ static_cast<float>(sample_rate),
+ effects);
return true;
}
@@ -286,7 +289,8 @@ void WebRtcAudioCapturer::RemoveTrack(WebRtcLocalAudioTrack* track) {
void WebRtcAudioCapturer::SetCapturerSource(
const scoped_refptr<media::AudioCapturerSource>& source,
media::ChannelLayout channel_layout,
- float sample_rate) {
+ float sample_rate,
+ const media::AudioParameters::PlatformEffects& effects) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "SetCapturerSource(channel_layout=" << channel_layout << ","
<< "sample_rate=" << sample_rate << ")";
@@ -312,7 +316,7 @@ void WebRtcAudioCapturer::SetCapturerSource(
// Dispatch the new parameters both to the sink(s) and to the new source.
// The idea is to get rid of any dependency of the microphone parameters
// which would normally be used by default.
- Reconfigure(sample_rate, channel_layout);
+ Reconfigure(sample_rate, channel_layout, effects);
// Make sure to grab the new parameters in case they were reconfigured.
media::AudioParameters params = audio_parameters();
@@ -351,7 +355,8 @@ void WebRtcAudioCapturer::EnablePeerConnectionMode() {
// WebRtc native buffer size.
SetCapturerSource(AudioDeviceFactory::NewInputDevice(render_view_id),
params.channel_layout(),
- static_cast<float>(params.sample_rate()));
+ static_cast<float>(params.sample_rate()),
+ params.effects());
}
void WebRtcAudioCapturer::Start() {

Powered by Google App Engine
This is Rietveld 408576698