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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 int WebRtcAudioCapturer::Volume() const { | 428 int WebRtcAudioCapturer::Volume() const { |
429 base::AutoLock auto_lock(lock_); | 429 base::AutoLock auto_lock(lock_); |
430 return volume_; | 430 return volume_; |
431 } | 431 } |
432 | 432 |
433 int WebRtcAudioCapturer::MaxVolume() const { | 433 int WebRtcAudioCapturer::MaxVolume() const { |
434 return WebRtcAudioDeviceImpl::kMaxVolumeLevel; | 434 return WebRtcAudioDeviceImpl::kMaxVolumeLevel; |
435 } | 435 } |
436 | 436 |
| 437 media::AudioParameters WebRtcAudioCapturer::GetOutputFormat() const { |
| 438 DCHECK(thread_checker_.CalledOnValidThread()); |
| 439 return audio_processor_->OutputFormat(); |
| 440 } |
| 441 |
437 void WebRtcAudioCapturer::Capture(const media::AudioBus* audio_source, | 442 void WebRtcAudioCapturer::Capture(const media::AudioBus* audio_source, |
438 int audio_delay_milliseconds, | 443 int audio_delay_milliseconds, |
439 double volume, | 444 double volume, |
440 bool key_pressed) { | 445 bool key_pressed) { |
441 // This callback is driven by AudioInputDevice::AudioThreadCallback if | 446 // This callback is driven by AudioInputDevice::AudioThreadCallback if |
442 // |source_| is AudioInputDevice, otherwise it is driven by client's | 447 // |source_| is AudioInputDevice, otherwise it is driven by client's |
443 // CaptureCallback. | 448 // CaptureCallback. |
444 #if defined(OS_WIN) || defined(OS_MACOSX) | 449 #if defined(OS_WIN) || defined(OS_MACOSX) |
445 DCHECK_LE(volume, 1.0); | 450 DCHECK_LE(volume, 1.0); |
446 #elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_OPENBSD) | 451 #elif (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_OPENBSD) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 587 |
583 void WebRtcAudioCapturer::SetCapturerSourceForTesting( | 588 void WebRtcAudioCapturer::SetCapturerSourceForTesting( |
584 const scoped_refptr<media::AudioCapturerSource>& source, | 589 const scoped_refptr<media::AudioCapturerSource>& source, |
585 media::AudioParameters params) { | 590 media::AudioParameters params) { |
586 // Create a new audio stream as source which uses the new source. | 591 // Create a new audio stream as source which uses the new source. |
587 SetCapturerSource(source, params.channel_layout(), | 592 SetCapturerSource(source, params.channel_layout(), |
588 static_cast<float>(params.sample_rate())); | 593 static_cast<float>(params.sample_rate())); |
589 } | 594 } |
590 | 595 |
591 } // namespace content | 596 } // namespace content |
OLD | NEW |