Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: content/renderer/media/webrtc_audio_capturer.cc

Issue 14049003: Set default sampling rate to 44100 and query the native output sampling rate. (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: rebase Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/webrtc_audio_device_impl.h" 13 #include "content/renderer/media/webrtc_audio_device_impl.h"
14 #include "media/audio/audio_util.h" 14 #include "media/audio/audio_util.h"
15 #include "media/audio/sample_rates.h" 15 #include "media/audio/sample_rates.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 // Supported hardware sample rates for input and output sides. 19 // Supported hardware sample rates for input and output sides.
20 #if defined(OS_WIN) || defined(OS_MACOSX) 20 #if defined(OS_WIN) || defined(OS_MACOSX)
21 // media::GetAudioInputHardwareSampleRate() asks the audio layer 21 // media::GetAudioInputHardwareSampleRate() asks the audio layer
22 // for its current sample rate (set by the user) on Windows and Mac OS X. 22 // for its current sample rate (set by the user) on Windows and Mac OS X.
23 // The listed rates below adds restrictions and WebRtcAudioDeviceImpl::Init() 23 // The listed rates below adds restrictions and WebRtcAudioDeviceImpl::Init()
24 // will fail if the user selects any rate outside these ranges. 24 // will fail if the user selects any rate outside these ranges.
25 static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000, 8000}; 25 static int kValidInputRates[] = {96000, 48000, 44100, 32000, 16000, 8000};
26 #elif defined(OS_LINUX) || defined(OS_OPENBSD) 26 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
27 static int kValidInputRates[] = {48000, 44100}; 27 static int kValidInputRates[] = {48000, 44100};
28 #elif defined(OS_ANDROID) 28 #elif defined(OS_ANDROID)
29 static int kValidInputRates[] = {48000, 44100, 16000}; 29 static int kValidInputRates[] = {48000, 44100};
30 #else 30 #else
31 static int kValidInputRates[] = {44100}; 31 static int kValidInputRates[] = {44100};
32 #endif 32 #endif
33 33
34 static int GetBufferSizeForSampleRate(int sample_rate) { 34 static int GetBufferSizeForSampleRate(int sample_rate) {
35 int buffer_size = 0; 35 int buffer_size = 0;
36 #if defined(OS_WIN) || defined(OS_MACOSX) 36 #if defined(OS_WIN) || defined(OS_MACOSX)
37 // Use different buffer sizes depending on the current hardware sample rate. 37 // Use different buffer sizes depending on the current hardware sample rate.
38 if (sample_rate == 44100) { 38 if (sample_rate == 44100) {
39 // We do run at 44.1kHz at the actual audio layer, but ask for frames 39 // We do run at 44.1kHz at the actual audio layer, but ask for frames
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 void WebRtcAudioCapturer::OnCaptureError() { 440 void WebRtcAudioCapturer::OnCaptureError() {
441 NOTIMPLEMENTED(); 441 NOTIMPLEMENTED();
442 } 442 }
443 443
444 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const { 444 media::AudioParameters WebRtcAudioCapturer::audio_parameters() const {
445 base::AutoLock auto_lock(lock_); 445 base::AutoLock auto_lock(lock_);
446 return buffer_->params(); 446 return buffer_->params();
447 } 447 }
448 448
449 } // namespace content 449 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | media/audio/android/audio_manager_android.h » ('j') | media/audio/android/audio_manager_android.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698