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

Side by Side Diff: webrtc/modules/audio_device/mac/audio_device_mac.cc

Issue 2466613002: Adds thread safety annotations to the AudioDeviceBuffer class (Closed)
Patch Set: Minor thread change for Windows Created 4 years, 1 month 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 /* 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 if (_outStreamFormat.mChannelsPerFrame < 2) { 1174 if (_outStreamFormat.mChannelsPerFrame < 2) {
1175 // Disable stereo playout when we only have one channel on the device. 1175 // Disable stereo playout when we only have one channel on the device.
1176 _playChannels = 1; 1176 _playChannels = 1;
1177 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, 1177 WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
1178 "Stereo playout unavailable on this device"); 1178 "Stereo playout unavailable on this device");
1179 } 1179 }
1180 WEBRTC_CA_RETURN_ON_ERR(SetDesiredPlayoutFormat()); 1180 WEBRTC_CA_RETURN_ON_ERR(SetDesiredPlayoutFormat());
1181 1181
1182 // Listen for format changes. 1182 // Listen for format changes.
1183 propertyAddress.mSelector = kAudioDevicePropertyStreamFormat; 1183 propertyAddress.mSelector = kAudioDevicePropertyStreamFormat;
1184 WEBRTC_CA_RETURN_ON_ERR(AudioObjectAddPropertyListener( 1184 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener(
1185 _outputDeviceID, &propertyAddress, &objectListenerProc, this)); 1185 _outputDeviceID, &propertyAddress, &objectListenerProc, this));
1186 1186
1187 // Listen for processor overloads. 1187 // Listen for processor overloads.
1188 propertyAddress.mSelector = kAudioDeviceProcessorOverload; 1188 propertyAddress.mSelector = kAudioDeviceProcessorOverload;
1189 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener( 1189 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener(
1190 _outputDeviceID, &propertyAddress, &objectListenerProc, this)); 1190 _outputDeviceID, &propertyAddress, &objectListenerProc, this));
1191 1191
1192 if (_twoDevices || !_recIsInitialized) { 1192 if (_twoDevices || !_recIsInitialized) {
1193 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID( 1193 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(
1194 _outputDeviceID, deviceIOProc, this, &_deviceIOProcID)); 1194 _outputDeviceID, deviceIOProc, this, &_deviceIOProcID));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 size = sizeof(UInt32); 1372 size = sizeof(UInt32);
1373 latency = 0; 1373 latency = 0;
1374 WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData( 1374 WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
1375 _inputDeviceID, &propertyAddress, 0, NULL, &size, &latency)); 1375 _inputDeviceID, &propertyAddress, 0, NULL, &size, &latency));
1376 _captureLatencyUs += 1376 _captureLatencyUs +=
1377 (UInt32)((1.0e6 * latency) / _inStreamFormat.mSampleRate); 1377 (UInt32)((1.0e6 * latency) / _inStreamFormat.mSampleRate);
1378 1378
1379 // Listen for format changes 1379 // Listen for format changes
1380 // TODO(xians): should we be using kAudioDevicePropertyDeviceHasChanged? 1380 // TODO(xians): should we be using kAudioDevicePropertyDeviceHasChanged?
1381 propertyAddress.mSelector = kAudioDevicePropertyStreamFormat; 1381 propertyAddress.mSelector = kAudioDevicePropertyStreamFormat;
1382 WEBRTC_CA_RETURN_ON_ERR(AudioObjectAddPropertyListener( 1382 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener(
1383 _inputDeviceID, &propertyAddress, &objectListenerProc, this)); 1383 _inputDeviceID, &propertyAddress, &objectListenerProc, this));
1384 1384
1385 // Listen for processor overloads 1385 // Listen for processor overloads
1386 propertyAddress.mSelector = kAudioDeviceProcessorOverload; 1386 propertyAddress.mSelector = kAudioDeviceProcessorOverload;
1387 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener( 1387 WEBRTC_CA_LOG_WARN(AudioObjectAddPropertyListener(
1388 _inputDeviceID, &propertyAddress, &objectListenerProc, this)); 1388 _inputDeviceID, &propertyAddress, &objectListenerProc, this));
1389 1389
1390 if (_twoDevices) { 1390 if (_twoDevices) {
1391 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID( 1391 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(
1392 _inputDeviceID, inDeviceIOProc, this, &_inDeviceIOProcID)); 1392 _inputDeviceID, inDeviceIOProc, this, &_inDeviceIOProcID));
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 bool keyState = 2769 bool keyState =
2770 CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, key_index); 2770 CGEventSourceKeyState(kCGEventSourceStateHIDSystemState, key_index);
2771 // A false -> true change in keymap means a key is pressed. 2771 // A false -> true change in keymap means a key is pressed.
2772 key_down |= (keyState && !prev_key_state_[key_index]); 2772 key_down |= (keyState && !prev_key_state_[key_index]);
2773 // Save current state. 2773 // Save current state.
2774 prev_key_state_[key_index] = keyState; 2774 prev_key_state_[key_index] = keyState;
2775 } 2775 }
2776 return key_down; 2776 return key_down;
2777 } 2777 }
2778 } // namespace webrtc 2778 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/audio_device_impl.cc ('k') | webrtc/modules/audio_device/test/audio_device_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698