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

Side by Side Diff: content/browser/renderer_host/media/audio_input_device_manager.cc

Issue 12316131: Moved AudioUtil static functions to AudioManager interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: made the GetPreferredOutputStreamParameters protected Created 7 years, 9 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
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/renderer_host/media/audio_input_device_manager.h" 5 #include "content/browser/renderer_host/media/audio_input_device_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/media/audio_input_device_manager_event_h andler.h" 9 #include "content/browser/renderer_host/media/audio_input_device_manager_event_h andler.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "content/public/common/media_stream_request.h" 11 #include "content/public/common/media_stream_request.h"
12 #include "media/audio/audio_device_name.h" 12 #include "media/audio/audio_device_name.h"
13 #include "media/audio/audio_input_ipc.h" 13 #include "media/audio/audio_input_ipc.h"
14 #include "media/audio/audio_manager_base.h" 14 #include "media/audio/audio_manager_base.h"
15 #include "media/audio/audio_util.h" 15 #include "media/audio/audio_parameters.h"
16 #include "media/base/channel_layout.h" 16 #include "media/base/channel_layout.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 const int AudioInputDeviceManager::kFakeOpenSessionId = 1; 20 const int AudioInputDeviceManager::kFakeOpenSessionId = 1;
21 21
22 namespace { 22 namespace {
23 // Starting id for the first capture session. 23 // Starting id for the first capture session.
24 const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1; 24 const int kFirstSessionId = AudioInputDeviceManager::kFakeOpenSessionId + 1;
25 } 25 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 default: 151 default:
152 NOTREACHED(); 152 NOTREACHED();
153 break; 153 break;
154 } 154 }
155 155
156 scoped_ptr<StreamDeviceInfoArray> devices(new StreamDeviceInfoArray()); 156 scoped_ptr<StreamDeviceInfoArray> devices(new StreamDeviceInfoArray());
157 for (media::AudioDeviceNames::iterator it = device_names.begin(); 157 for (media::AudioDeviceNames::iterator it = device_names.begin();
158 it != device_names.end(); ++it) { 158 it != device_names.end(); ++it) {
159 // Get the preferred sample rate and channel configuration for the 159 // Get the preferred sample rate and channel configuration for the
160 // current audio device. 160 // current audio device.
161 int sample_rate = 161 media::AudioParameters default_params =
162 media::GetAudioInputHardwareSampleRate(it->unique_id); 162 audio_manager_->GetInputStreamParameters(it->unique_id);
163 media::ChannelLayout channel_layout =
164 media::GetAudioInputHardwareChannelLayout(it->unique_id);
165 163
166 // Add device information to device vector. 164 // Add device information to device vector.
167 devices->push_back(StreamDeviceInfo( 165 devices->push_back(StreamDeviceInfo(
168 stream_type, it->device_name, it->unique_id, sample_rate, 166 stream_type, it->device_name, it->unique_id,
169 channel_layout, false)); 167 default_params.sample_rate(), default_params.channel_layout(), false));
170 } 168 }
171 169
172 // Return the device list through the listener by posting a task on 170 // Return the device list through the listener by posting a task on
173 // IO thread since MediaStreamManager handles the callback asynchronously. 171 // IO thread since MediaStreamManager handles the callback asynchronously.
174 BrowserThread::PostTask( 172 BrowserThread::PostTask(
175 BrowserThread::IO, 173 BrowserThread::IO,
176 FROM_HERE, 174 FROM_HERE,
177 base::Bind(&AudioInputDeviceManager::DevicesEnumeratedOnIOThread, 175 base::Bind(&AudioInputDeviceManager::DevicesEnumeratedOnIOThread,
178 this, stream_type, base::Passed(&devices))); 176 this, stream_type, base::Passed(&devices)));
179 } 177 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 232 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
235 if (listener_) 233 if (listener_)
236 listener_->Closed(stream_type, session_id); 234 listener_->Closed(stream_type, session_id);
237 } 235 }
238 236
239 bool AudioInputDeviceManager::IsOnDeviceThread() const { 237 bool AudioInputDeviceManager::IsOnDeviceThread() const {
240 return device_loop_->BelongsToCurrentThread(); 238 return device_loop_->BelongsToCurrentThread();
241 } 239 }
242 240
243 } // namespace content 241 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/media/media_stream_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698