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

Side by Side Diff: webrtc/modules/audio_device/win/audio_mixer_manager_win.cc

Issue 1269563002: Added protection for GetCapabilities() failure. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 UINT mixId(0); 189 UINT mixId(0);
190 UINT destId(0); 190 UINT destId(0);
191 191
192 ClearSpeakerState(); 192 ClearSpeakerState();
193 193
194 // scan all avaliable mixer devices 194 // scan all avaliable mixer devices
195 for (mixId = 0; mixId < nDevices; mixId++) 195 for (mixId = 0; mixId < nDevices; mixId++)
196 { 196 {
197 // get capabilities for the specified mixer ID 197 // get capabilities for the specified mixer ID
198 GetCapabilities(mixId, caps); 198 if (!GetCapabilities(mixId, caps))
199 continue;
200
199 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[mixerID=%d] %s: ", mi xId, WideToUTF8(caps.szPname)); 201 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[mixerID=%d] %s: ", mi xId, WideToUTF8(caps.szPname));
200 // scan all avaliable destinations for this mixer 202 // scan all avaliable destinations for this mixer
201 for (destId = 0; destId < caps.cDestinations; destId++) 203 for (destId = 0; destId < caps.cDestinations; destId++)
202 { 204 {
203 GetDestinationLineInfo(mixId, destId, destLine); 205 GetDestinationLineInfo(mixId, destId, destLine);
204 if ((destLine.cControls == 0) || // no co ntrols or 206 if ((destLine.cControls == 0) || // no co ntrols or
205 (destLine.cConnections == 0) || // no so urce lines or 207 (destLine.cConnections == 0) || // no so urce lines or
206 (destLine.fdwLine & MIXERLINE_LINEF_DISCONNECTED) || // disco nnected or 208 (destLine.fdwLine & MIXERLINE_LINEF_DISCONNECTED) || // disco nnected or
207 !(destLine.fdwLine & MIXERLINE_LINEF_ACTIVE)) // inact ive 209 !(destLine.fdwLine & MIXERLINE_LINEF_ACTIVE)) // inact ive
208 { 210 {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 275
274 UINT mixId(0); 276 UINT mixId(0);
275 UINT destId(0); 277 UINT destId(0);
276 278
277 ClearMicrophoneState(); 279 ClearMicrophoneState();
278 280
279 // scan all avaliable mixer devices 281 // scan all avaliable mixer devices
280 for (mixId = 0; mixId < nDevices; mixId++) 282 for (mixId = 0; mixId < nDevices; mixId++)
281 { 283 {
282 // get capabilities for the specified mixer ID 284 // get capabilities for the specified mixer ID
283 GetCapabilities(mixId, caps); 285 if (!GetCapabilities(mixId, caps))
286 continue;
287
284 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[mixerID=%d] %s: ", mi xId, WideToUTF8(caps.szPname)); 288 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "[mixerID=%d] %s: ", mi xId, WideToUTF8(caps.szPname));
285 // scan all avaliable destinations for this mixer 289 // scan all avaliable destinations for this mixer
286 for (destId = 0; destId < caps.cDestinations; destId++) 290 for (destId = 0; destId < caps.cDestinations; destId++)
287 { 291 {
288 GetDestinationLineInfo(mixId, destId, destLine); 292 GetDestinationLineInfo(mixId, destId, destLine);
289 293
290 if ((destLine.cConnections == 0) || // no so urce lines or 294 if ((destLine.cConnections == 0) || // no so urce lines or
291 (destLine.fdwLine & MIXERLINE_LINEF_DISCONNECTED) || // disco nnected or 295 (destLine.fdwLine & MIXERLINE_LINEF_DISCONNECTED) || // disco nnected or
292 !(destLine.fdwLine & MIXERLINE_LINEF_ACTIVE)) // inact ive 296 !(destLine.fdwLine & MIXERLINE_LINEF_ACTIVE)) // inact ive
293 { 297 {
(...skipping 2418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0) 2716 if (WideCharToMultiByte(CP_UTF8, 0, src, -1, _str, kStrLen, 0, 0) == 0)
2713 memset(_str, 0, kStrLen); 2717 memset(_str, 0, kStrLen);
2714 } 2718 }
2715 return _str; 2719 return _str;
2716 #else 2720 #else
2717 return const_cast<char*>(src); 2721 return const_cast<char*>(src);
2718 #endif 2722 #endif
2719 } 2723 }
2720 2724
2721 } // namespace webrtc 2725 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698