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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 WebRtcAudioCapturer::WebRtcAudioCapturer( | 238 WebRtcAudioCapturer::WebRtcAudioCapturer( |
239 int render_frame_id, | 239 int render_frame_id, |
240 const StreamDeviceInfo& device_info, | 240 const StreamDeviceInfo& device_info, |
241 const blink::WebMediaConstraints& constraints, | 241 const blink::WebMediaConstraints& constraints, |
242 WebRtcAudioDeviceImpl* audio_device, | 242 WebRtcAudioDeviceImpl* audio_device, |
243 MediaStreamAudioSource* audio_source) | 243 MediaStreamAudioSource* audio_source) |
244 : constraints_(constraints), | 244 : constraints_(constraints), |
245 audio_processor_(new rtc::RefCountedObject<MediaStreamAudioProcessor>( | 245 audio_processor_(new rtc::RefCountedObject<MediaStreamAudioProcessor>( |
246 constraints, | 246 constraints, |
247 device_info.device.input.effects, | 247 device_info.device.input, |
248 audio_device)), | 248 audio_device)), |
249 running_(false), | 249 running_(false), |
250 render_frame_id_(render_frame_id), | 250 render_frame_id_(render_frame_id), |
251 device_info_(device_info), | 251 device_info_(device_info), |
252 volume_(0), | 252 volume_(0), |
253 peer_connection_mode_(false), | 253 peer_connection_mode_(false), |
254 audio_device_(audio_device), | 254 audio_device_(audio_device), |
255 audio_source_(audio_source) { | 255 audio_source_(audio_source) { |
256 DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()"; | 256 DVLOG(1) << "WebRtcAudioCapturer::WebRtcAudioCapturer()"; |
257 } | 257 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 std::vector<media::Point>(), |
348 16, | |
349 buffer_size, | |
350 device_info_.device.input.effects); | 348 device_info_.device.input.effects); |
351 | 349 |
352 { | 350 { |
353 base::AutoLock auto_lock(lock_); | 351 base::AutoLock auto_lock(lock_); |
354 // Notify the |audio_processor_| of the new format. | 352 // Notify the |audio_processor_| of the new format. |
355 audio_processor_->OnCaptureFormatChanged(params); | 353 audio_processor_->OnCaptureFormatChanged(params); |
356 | 354 |
357 // Notify all tracks about the new format. | 355 // Notify all tracks about the new format. |
358 tracks_.TagAll(); | 356 tracks_.TagAll(); |
359 } | 357 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 const scoped_refptr<media::AudioCapturerSource>& source, | 617 const scoped_refptr<media::AudioCapturerSource>& source, |
620 media::AudioParameters params) { | 618 media::AudioParameters params) { |
621 // Create a new audio stream as source which uses the new source. | 619 // Create a new audio stream as source which uses the new source. |
622 SetCapturerSourceInternal(source, | 620 SetCapturerSourceInternal(source, |
623 params.channel_layout(), | 621 params.channel_layout(), |
624 params.sample_rate(), | 622 params.sample_rate(), |
625 0); | 623 0); |
626 } | 624 } |
627 | 625 |
628 } // namespace content | 626 } // namespace content |
OLD | NEW |