| 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/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "content/common/child_process.h" | 11 #include "content/common/child_process.h" |
| 12 #include "content/renderer/media/audio_device_factory.h" | 12 #include "content/renderer/media/audio_device_factory.h" |
| 13 #include "content/renderer/media/audio_hardware.h" | 13 #include "content/renderer/media/renderer_audio_hardware_config.h" |
| 14 #include "content/renderer/media/webrtc_audio_device_impl.h" | 14 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 15 #include "content/renderer/media/webrtc_local_audio_renderer.h" | 15 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
| 16 #include "content/renderer/render_thread_impl.h" |
| 16 #include "media/audio/audio_util.h" | 17 #include "media/audio/audio_util.h" |
| 17 #include "media/audio/sample_rates.h" | 18 #include "media/audio/sample_rates.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 // Supported hardware sample rates for input and output sides. | 22 // Supported hardware sample rates for input and output sides. |
| 22 #if defined(OS_WIN) || defined(OS_MACOSX) | 23 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 23 // media::GetAudioInputHardwareSampleRate() asks the audio layer | 24 // RendererAudioHardwareConfig::GetInputSampleRate() asks the audio layer |
| 24 // for its current sample rate (set by the user) on Windows and Mac OS X. | 25 // for its current sample rate (set by the user) on Windows and Mac OS X. |
| 25 // The listed rates below adds restrictions and WebRtcAudioDeviceImpl::Init() | 26 // The listed rates below adds restrictions and WebRtcAudioDeviceImpl::Init() |
| 26 // will fail if the user selects any rate outside these ranges. | 27 // will fail if the user selects any rate outside these ranges. |
| 27 static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000, 8000}; | 28 static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000, 8000}; |
| 28 #elif defined(OS_LINUX) || defined(OS_OPENBSD) | 29 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
| 29 static int kValidInputRates[] = {48000, 44100}; | 30 static int kValidInputRates[] = {48000, 44100}; |
| 30 #elif defined(OS_ANDROID) | 31 #elif defined(OS_ANDROID) |
| 31 static int kValidInputRates[] = {48000, 44100, 16000}; | 32 static int kValidInputRates[] = {48000, 44100, 16000}; |
| 32 #else | 33 #else |
| 33 static int kValidInputRates[] = {44100}; | 34 static int kValidInputRates[] = {44100}; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // Inform the local renderer about the stopped device. | 419 // Inform the local renderer about the stopped device. |
| 419 // The renderer can then save resources by not asking for more data from | 420 // The renderer can then save resources by not asking for more data from |
| 420 // the stopped source. We are on the IO thread but the callback task will | 421 // the stopped source. We are on the IO thread but the callback task will |
| 421 // be posted on the message loop of the main render thread thanks to | 422 // be posted on the message loop of the main render thread thanks to |
| 422 // usage of BindToLoop() when the callback was initialized. | 423 // usage of BindToLoop() when the callback was initialized. |
| 423 if (!on_device_stopped_cb_.is_null()) | 424 if (!on_device_stopped_cb_.is_null()) |
| 424 on_device_stopped_cb_.Run(); | 425 on_device_stopped_cb_.Run(); |
| 425 } | 426 } |
| 426 | 427 |
| 427 } // namespace content | 428 } // namespace content |
| OLD | NEW |