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_device_impl.h" | 5 #include "content/renderer/media/webrtc_audio_device_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 // Calling Init() multiple times in a row is OK. | 416 // Calling Init() multiple times in a row is OK. |
417 if (initialized_) | 417 if (initialized_) |
418 return 0; | 418 return 0; |
419 | 419 |
420 DCHECK(!audio_input_device_); | 420 DCHECK(!audio_input_device_); |
421 DCHECK(!input_buffer_.get()); | 421 DCHECK(!input_buffer_.get()); |
422 DCHECK(!output_buffer_.get()); | 422 DCHECK(!output_buffer_.get()); |
423 | 423 |
424 // TODO(henrika): it could be possible to allow one of the directions (input | 424 // TODO(henrika): it could be possible to allow one of the directions (input |
425 // or output) to use a non-supported rate. As an example: if only the | 425 // or output) to use a non-supported rate. As an example: if only the |
426 // output rate is OK, we could finalize Init() and only set up an AudioDevice. | 426 // output rate is OK, we could finalize Init() and only set up an |
| 427 // AudioOutputDevice. |
427 | 428 |
428 // Ask the browser for the default audio output hardware sample-rate. | 429 // Ask the browser for the default audio output hardware sample-rate. |
429 // This request is based on a synchronous IPC message. | 430 // This request is based on a synchronous IPC message. |
430 int out_sample_rate = audio_hardware::GetOutputSampleRate(); | 431 int out_sample_rate = audio_hardware::GetOutputSampleRate(); |
431 DVLOG(1) << "Audio output hardware sample rate: " << out_sample_rate; | 432 DVLOG(1) << "Audio output hardware sample rate: " << out_sample_rate; |
432 AddHistogramSampleRate(kAudioOutput, out_sample_rate); | 433 AddHistogramSampleRate(kAudioOutput, out_sample_rate); |
433 | 434 |
434 // Verify that the reported output hardware sample rate is supported | 435 // Verify that the reported output hardware sample rate is supported |
435 // on the current platform. | 436 // on the current platform. |
436 if (std::find(&kValidOutputRates[0], | 437 if (std::find(&kValidOutputRates[0], |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 } | 1168 } |
1168 | 1169 |
1169 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { | 1170 int32_t WebRtcAudioDeviceImpl::GetLoudspeakerStatus(bool* enabled) const { |
1170 NOTIMPLEMENTED(); | 1171 NOTIMPLEMENTED(); |
1171 return -1; | 1172 return -1; |
1172 } | 1173 } |
1173 | 1174 |
1174 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { | 1175 void WebRtcAudioDeviceImpl::SetSessionId(int session_id) { |
1175 session_id_ = session_id; | 1176 session_id_ = session_id; |
1176 } | 1177 } |
OLD | NEW |