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

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

Issue 190713004: Only turn on the audio processing by default for MEDIA_DEVICE_AUDIO_CAPTURE (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: added unittest to protect the use cases. Created 6 years, 9 months 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 #include "content/renderer/media/webrtc_audio_capturer.h" 5 #include "content/renderer/media/webrtc_audio_capturer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // also apply the new |constraints|. 297 // also apply the new |constraints|.
298 // The idea is to get rid of any dependency of the microphone parameters 298 // The idea is to get rid of any dependency of the microphone parameters
299 // which would normally be used by default. 299 // which would normally be used by default.
300 // bits_per_sample is always 16 for now. 300 // bits_per_sample is always 16 for now.
301 int buffer_size = GetBufferSize(sample_rate); 301 int buffer_size = GetBufferSize(sample_rate);
302 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 302 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
303 channel_layout, 0, sample_rate, 303 channel_layout, 0, sample_rate,
304 16, buffer_size, effects); 304 16, buffer_size, effects);
305 scoped_refptr<MediaStreamAudioProcessor> new_audio_processor( 305 scoped_refptr<MediaStreamAudioProcessor> new_audio_processor(
306 new talk_base::RefCountedObject<MediaStreamAudioProcessor>( 306 new talk_base::RefCountedObject<MediaStreamAudioProcessor>(
307 params, constraints, effects, audio_device_)); 307 params, constraints, effects, device_info_.device.type,
308 audio_device_));
308 { 309 {
309 base::AutoLock auto_lock(lock_); 310 base::AutoLock auto_lock(lock_);
310 audio_processor_ = new_audio_processor; 311 audio_processor_ = new_audio_processor;
311 need_audio_processing_ = NeedsAudioProcessing(constraints, effects); 312 need_audio_processing_ = NeedsAudioProcessing(constraints, effects);
312 313
313 // Notify all tracks about the new format. 314 // Notify all tracks about the new format.
314 tracks_.TagAll(); 315 tracks_.TagAll();
315 } 316 }
316 317
317 if (source.get()) 318 if (source.get())
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 const scoped_refptr<media::AudioCapturerSource>& source, 569 const scoped_refptr<media::AudioCapturerSource>& source,
569 media::AudioParameters params) { 570 media::AudioParameters params) {
570 // Create a new audio stream as source which uses the new source. 571 // Create a new audio stream as source which uses the new source.
571 SetCapturerSource(source, params.channel_layout(), 572 SetCapturerSource(source, params.channel_layout(),
572 static_cast<float>(params.sample_rate()), 573 static_cast<float>(params.sample_rate()),
573 params.effects(), 574 params.effects(),
574 constraints_); 575 constraints_);
575 } 576 }
576 577
577 } // namespace content 578 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698