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 #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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 if (old_source.get()) | 320 if (old_source.get()) |
321 old_source->Stop(); | 321 old_source->Stop(); |
322 | 322 |
323 // Dispatch the new parameters both to the sink(s) and to the new source, | 323 // Dispatch the new parameters both to the sink(s) and to the new source, |
324 // also apply the new |constraints|. | 324 // also apply the new |constraints|. |
325 // The idea is to get rid of any dependency of the microphone parameters | 325 // The idea is to get rid of any dependency of the microphone parameters |
326 // which would normally be used by default. | 326 // which would normally be used by default. |
327 // bits_per_sample is always 16 for now. | 327 // bits_per_sample is always 16 for now. |
328 int buffer_size = GetBufferSize(sample_rate); | 328 int buffer_size = GetBufferSize(sample_rate); |
329 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, | 329 media::AudioParameters params(media::AudioParameters::AUDIO_PCM_LOW_LATENCY, |
330 channel_layout, 0, sample_rate, | 330 channel_layout, sample_rate, |
331 16, buffer_size, | 331 16, buffer_size, |
332 device_info_.device.input.effects); | 332 device_info_.device.input.effects); |
333 | 333 |
334 { | 334 { |
335 base::AutoLock auto_lock(lock_); | 335 base::AutoLock auto_lock(lock_); |
336 // Notify the |audio_processor_| of the new format. | 336 // Notify the |audio_processor_| of the new format. |
337 audio_processor_->OnCaptureFormatChanged(params); | 337 audio_processor_->OnCaptureFormatChanged(params); |
338 | 338 |
339 MediaAudioConstraints audio_constraints(constraints_, | 339 MediaAudioConstraints audio_constraints(constraints_, |
340 device_info_.device.input.effects); | 340 device_info_.device.input.effects); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 void WebRtcAudioCapturer::SetCapturerSourceForTesting( | 610 void WebRtcAudioCapturer::SetCapturerSourceForTesting( |
611 const scoped_refptr<media::AudioCapturerSource>& source, | 611 const scoped_refptr<media::AudioCapturerSource>& source, |
612 media::AudioParameters params) { | 612 media::AudioParameters params) { |
613 // Create a new audio stream as source which uses the new source. | 613 // Create a new audio stream as source which uses the new source. |
614 SetCapturerSource(source, params.channel_layout(), | 614 SetCapturerSource(source, params.channel_layout(), |
615 static_cast<float>(params.sample_rate())); | 615 static_cast<float>(params.sample_rate())); |
616 } | 616 } |
617 | 617 |
618 } // namespace content | 618 } // namespace content |
OLD | NEW |