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

Side by Side Diff: media/audio/win/wavein_input_win.cc

Issue 9566002: On windows, create PCMWaveInAudioInputStream instance with correct device ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test. Created 8 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 | « media/audio/win/wavein_input_win.h ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('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 "media/audio/win/wavein_input_win.h" 5 #include "media/audio/win/wavein_input_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #pragma comment(lib, "winmm.lib") 9 #pragma comment(lib, "winmm.lib")
10 10
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 bool PCMWaveInAudioInputStream::GetDeviceId(UINT* device_index) { 215 bool PCMWaveInAudioInputStream::GetDeviceId(UINT* device_index) {
216 // Deliver the default input device id (WAVE_MAPPER) if the default 216 // Deliver the default input device id (WAVE_MAPPER) if the default
217 // device has been selected. 217 // device has been selected.
218 if (device_id_ == AudioManagerBase::kDefaultDeviceId) { 218 if (device_id_ == AudioManagerBase::kDefaultDeviceId) {
219 *device_index = WAVE_MAPPER; 219 *device_index = WAVE_MAPPER;
220 return true; 220 return true;
221 } 221 }
222 222
223 // Get list of all available and active devices. 223 // Get list of all available and active devices.
224 AudioDeviceNames device_names; 224 AudioDeviceNames device_names;
225 if (!GetInputDeviceNamesWinXP(&device_names)) 225 if (!media::GetInputDeviceNamesWinXP(&device_names))
226 return false; 226 return false;
227 227
228 if (device_names.empty()) 228 if (device_names.empty())
229 return false; 229 return false;
230 230
231 // Search the full list of devices and compare with the specified 231 // Search the full list of devices and compare with the specified
232 // device id which was specified in the constructor. Stop comparing 232 // device id which was specified in the constructor. Stop comparing
233 // when a match is found and return the corresponding index. 233 // when a match is found and return the corresponding index.
234 UINT index = 0; 234 UINT index = 0;
235 bool found_device = false; 235 bool found_device = false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // waveInPrepareHeader. 278 // waveInPrepareHeader.
279 obj->QueueNextPacket(buffer); 279 obj->QueueNextPacket(buffer);
280 } 280 }
281 } else if (msg == WIM_CLOSE) { 281 } else if (msg == WIM_CLOSE) {
282 // We can be closed before calling Start, so it is possible to have a 282 // We can be closed before calling Start, so it is possible to have a
283 // null callback at this point. 283 // null callback at this point.
284 if (obj->callback_) 284 if (obj->callback_)
285 obj->callback_->OnClose(obj); 285 obj->callback_->OnClose(obj);
286 } 286 }
287 } 287 }
OLDNEW
« no previous file with comments | « media/audio/win/wavein_input_win.h ('k') | tools/valgrind/drmemory/suppressions_full.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698