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

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

Issue 1304973005: Refactor AudioParameters member setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cross-platform. Created 5 years, 3 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // We either default to 10ms, or use the hardware buffer size. 336 // We either default to 10ms, or use the hardware buffer size.
337 if (buffer_size == 0) 337 if (buffer_size == 0)
338 buffer_size = GetBufferSize(sample_rate); 338 buffer_size = GetBufferSize(sample_rate);
339 339
340 // Dispatch the new parameters both to the sink(s) and to the new source, 340 // Dispatch the new parameters both to the sink(s) and to the new source,
341 // also apply the new |constraints|. 341 // also apply the new |constraints|.
342 // The idea is to get rid of any dependency of the microphone parameters 342 // The idea is to get rid of any dependency of the microphone parameters
343 // which would normally be used by default. 343 // which would normally be used by default.
344 // bits_per_sample is always 16 for now. 344 // bits_per_sample is always 16 for now.
345 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, 345 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY,
346 channel_layout, 346 channel_layout, sample_rate, 16, buffer_size);
347 sample_rate, 347 params.set_effects(device_info_.device.input.effects);
348 16,
349 buffer_size,
350 device_info_.device.input.effects);
351 348
352 { 349 {
353 base::AutoLock auto_lock(lock_); 350 base::AutoLock auto_lock(lock_);
354 // Notify the |audio_processor_| of the new format. 351 // Notify the |audio_processor_| of the new format.
355 audio_processor_->OnCaptureFormatChanged(params); 352 audio_processor_->OnCaptureFormatChanged(params);
356 353
357 // Notify all tracks about the new format. 354 // Notify all tracks about the new format.
358 tracks_.TagAll(); 355 tracks_.TagAll();
359 } 356 }
360 357
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 const scoped_refptr<media::AudioCapturerSource>& source, 616 const scoped_refptr<media::AudioCapturerSource>& source,
620 media::AudioParameters params) { 617 media::AudioParameters params) {
621 // Create a new audio stream as source which uses the new source. 618 // Create a new audio stream as source which uses the new source.
622 SetCapturerSourceInternal(source, 619 SetCapturerSourceInternal(source,
623 params.channel_layout(), 620 params.channel_layout(),
624 params.sample_rate(), 621 params.sample_rate(),
625 0); 622 0);
626 } 623 }
627 624
628 } // namespace content 625 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698