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

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

Issue 9221010: Adds support for 16kHz input sample rate and mono channel config. in WebRTC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding 16 and 32kHz input support on Mac OS X Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/audio_hardware.h" 5 #include "content/renderer/media/audio_hardware.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/view_messages.h" 8 #include "content/common/view_messages.h"
9 #include "content/renderer/render_thread_impl.h" 9 #include "content/renderer/render_thread_impl.h"
10 10
11 static double output_sample_rate = 0.0; 11 static double output_sample_rate = 0.0;
12 static double input_sample_rate = 0.0; 12 static double input_sample_rate = 0.0;
13 static size_t output_buffer_size = 0; 13 static size_t output_buffer_size = 0;
14 static size_t input_channel_count = 0;
14 15
15 namespace audio_hardware { 16 namespace audio_hardware {
16 17
17 double GetOutputSampleRate() { 18 double GetOutputSampleRate() {
18 DCHECK(RenderThreadImpl::current() != NULL); 19 DCHECK(RenderThreadImpl::current() != NULL);
19 20
20 if (!output_sample_rate) { 21 if (!output_sample_rate) {
21 RenderThreadImpl::current()->Send( 22 RenderThreadImpl::current()->Send(
22 new ViewHostMsg_GetHardwareSampleRate(&output_sample_rate)); 23 new ViewHostMsg_GetHardwareSampleRate(&output_sample_rate));
23 } 24 }
(...skipping 16 matching lines...) Expand all
40 if (!output_buffer_size) { 41 if (!output_buffer_size) {
41 uint32 buffer_size = 0; 42 uint32 buffer_size = 0;
42 RenderThreadImpl::current()->Send( 43 RenderThreadImpl::current()->Send(
43 new ViewHostMsg_GetHardwareBufferSize(&buffer_size)); 44 new ViewHostMsg_GetHardwareBufferSize(&buffer_size));
44 output_buffer_size = buffer_size; 45 output_buffer_size = buffer_size;
45 } 46 }
46 47
47 return output_buffer_size; 48 return output_buffer_size;
48 } 49 }
49 50
51 size_t GetInputChannelCount() {
52 DCHECK(RenderThreadImpl::current() != NULL);
53
54 if (!input_channel_count) {
55 size_t channels = 0;
56 RenderThreadImpl::current()->Send(
57 new ViewHostMsg_GetHardwareInputChannelCount(&channels));
scherkus (not reviewing) 2012/01/18 18:19:38 indent
henrika (OOO until Aug 14) 2012/01/19 09:42:24 Done.
58 input_channel_count = channels;
59 }
60
61 return input_channel_count;
62 }
63
50 void ResetCache() { 64 void ResetCache() {
51 DCHECK(RenderThreadImpl::current() != NULL); 65 DCHECK(RenderThreadImpl::current() != NULL);
52 66
53 output_sample_rate = 0.0; 67 output_sample_rate = 0.0;
54 input_sample_rate = 0.0; 68 input_sample_rate = 0.0;
55 output_buffer_size = 0; 69 output_buffer_size = 0;
70 input_channel_count = 0;
56 } 71 }
57 72
58 } // namespace audio_hardware 73 } // namespace audio_hardware
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698