OLD | NEW |
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 |
11 #include "webrtc/base/arraysize.h" | 11 #include "webrtc/base/arraysize.h" |
12 #include "webrtc/base/checks.h" | 12 #include "webrtc/base/checks.h" |
| 13 #include "webrtc/base/platform_thread.h" |
13 #include "webrtc/modules/audio_device/audio_device_config.h" | 14 #include "webrtc/modules/audio_device/audio_device_config.h" |
14 #include "webrtc/modules/audio_device/mac/audio_device_mac.h" | 15 #include "webrtc/modules/audio_device/mac/audio_device_mac.h" |
15 #include "webrtc/modules/audio_device/mac/portaudio/pa_ringbuffer.h" | 16 #include "webrtc/modules/audio_device/mac/portaudio/pa_ringbuffer.h" |
16 #include "webrtc/system_wrappers/include/event_wrapper.h" | 17 #include "webrtc/system_wrappers/include/event_wrapper.h" |
17 #include "webrtc/system_wrappers/include/thread_wrapper.h" | |
18 #include "webrtc/system_wrappers/include/trace.h" | 18 #include "webrtc/system_wrappers/include/trace.h" |
19 | 19 |
20 #include <ApplicationServices/ApplicationServices.h> | 20 #include <ApplicationServices/ApplicationServices.h> |
21 #include <libkern/OSAtomic.h> // OSAtomicCompareAndSwap() | 21 #include <libkern/OSAtomic.h> // OSAtomicCompareAndSwap() |
22 #include <mach/mach.h> // mach_task_self() | 22 #include <mach/mach.h> // mach_task_self() |
23 #include <sys/sysctl.h> // sysctlbyname() | 23 #include <sys/sysctl.h> // sysctlbyname() |
24 | 24 |
25 | 25 |
26 | 26 |
27 namespace webrtc | 27 namespace webrtc |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 | 1659 |
1660 if (!_initialized) | 1660 if (!_initialized) |
1661 { | 1661 { |
1662 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 1662 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
1663 " Recording worker thread has not been started"); | 1663 " Recording worker thread has not been started"); |
1664 return -1; | 1664 return -1; |
1665 } | 1665 } |
1666 | 1666 |
1667 RTC_DCHECK(!capture_worker_thread_.get()); | 1667 RTC_DCHECK(!capture_worker_thread_.get()); |
1668 capture_worker_thread_ = | 1668 capture_worker_thread_ = |
1669 ThreadWrapper::CreateThread(RunCapture, this, "CaptureWorkerThread"); | 1669 PlatformThread::CreateThread(RunCapture, this, "CaptureWorkerThread"); |
1670 RTC_DCHECK(capture_worker_thread_.get()); | 1670 RTC_DCHECK(capture_worker_thread_.get()); |
1671 capture_worker_thread_->Start(); | 1671 capture_worker_thread_->Start(); |
1672 capture_worker_thread_->SetPriority(kRealtimePriority); | 1672 capture_worker_thread_->SetPriority(kRealtimePriority); |
1673 | 1673 |
1674 OSStatus err = noErr; | 1674 OSStatus err = noErr; |
1675 if (_twoDevices) | 1675 if (_twoDevices) |
1676 { | 1676 { |
1677 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _inDeviceIOProc
ID)); | 1677 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _inDeviceIOProc
ID)); |
1678 } else if (!_playing) | 1678 } else if (!_playing) |
1679 { | 1679 { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 return -1; | 1814 return -1; |
1815 } | 1815 } |
1816 | 1816 |
1817 if (_playing) | 1817 if (_playing) |
1818 { | 1818 { |
1819 return 0; | 1819 return 0; |
1820 } | 1820 } |
1821 | 1821 |
1822 RTC_DCHECK(!render_worker_thread_.get()); | 1822 RTC_DCHECK(!render_worker_thread_.get()); |
1823 render_worker_thread_ = | 1823 render_worker_thread_ = |
1824 ThreadWrapper::CreateThread(RunRender, this, "RenderWorkerThread"); | 1824 PlatformThread::CreateThread(RunRender, this, "RenderWorkerThread"); |
1825 render_worker_thread_->Start(); | 1825 render_worker_thread_->Start(); |
1826 render_worker_thread_->SetPriority(kRealtimePriority); | 1826 render_worker_thread_->SetPriority(kRealtimePriority); |
1827 | 1827 |
1828 if (_twoDevices || !_recording) | 1828 if (_twoDevices || !_recording) |
1829 { | 1829 { |
1830 OSStatus err = noErr; | 1830 OSStatus err = noErr; |
1831 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_outputDeviceID, _deviceIOProcI
D)); | 1831 WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_outputDeviceID, _deviceIOProcI
D)); |
1832 } | 1832 } |
1833 _playing = true; | 1833 _playing = true; |
1834 | 1834 |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3232 kCGEventSourceStateHIDSystemState, | 3232 kCGEventSourceStateHIDSystemState, |
3233 key_index); | 3233 key_index); |
3234 // A false -> true change in keymap means a key is pressed. | 3234 // A false -> true change in keymap means a key is pressed. |
3235 key_down |= (keyState && !prev_key_state_[key_index]); | 3235 key_down |= (keyState && !prev_key_state_[key_index]); |
3236 // Save current state. | 3236 // Save current state. |
3237 prev_key_state_[key_index] = keyState; | 3237 prev_key_state_[key_index] = keyState; |
3238 } | 3238 } |
3239 return key_down; | 3239 return key_down; |
3240 } | 3240 } |
3241 } // namespace webrtc | 3241 } // namespace webrtc |
OLD | NEW |