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 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 221 |
222 _mixerManager.EnumerateAll(); | 222 _mixerManager.EnumerateAll(); |
223 | 223 |
224 if (_ptrThread) | 224 if (_ptrThread) |
225 { | 225 { |
226 // thread is already created and active | 226 // thread is already created and active |
227 return 0; | 227 return 0; |
228 } | 228 } |
229 | 229 |
230 const char* threadName = "webrtc_audio_module_thread"; | 230 const char* threadName = "webrtc_audio_module_thread"; |
231 _ptrThread = PlatformThread::CreateThread(ThreadFunc, this, threadName); | 231 _ptrThread.reset(new rtc::PlatformThread(ThreadFunc, this, threadName)); |
232 if (!_ptrThread->Start()) | 232 _ptrThread->Start(); |
233 { | 233 _ptrThread->SetPriority(rtc::kRealtimePriority); |
234 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, | |
235 "failed to start the audio thread"); | |
236 _ptrThread.reset(); | |
237 return -1; | |
238 } | |
239 _ptrThread->SetPriority(kRealtimePriority); | |
240 | 234 |
241 const bool periodic(true); | 235 const bool periodic(true); |
242 if (!_timeEvent.StartTimer(periodic, TIMER_PERIOD_MS)) | 236 if (!_timeEvent.StartTimer(periodic, TIMER_PERIOD_MS)) |
243 { | 237 { |
244 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, | 238 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
245 "failed to start the timer event"); | 239 "failed to start the timer event"); |
246 _ptrThread->Stop(); | 240 _ptrThread->Stop(); |
247 _ptrThread.reset(); | 241 _ptrThread.reset(); |
248 return -1; | 242 return -1; |
249 } | 243 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 { | 282 { |
289 return 0; | 283 return 0; |
290 } | 284 } |
291 | 285 |
292 _critSect.Enter(); | 286 _critSect.Enter(); |
293 | 287 |
294 _mixerManager.Close(); | 288 _mixerManager.Close(); |
295 | 289 |
296 if (_ptrThread) | 290 if (_ptrThread) |
297 { | 291 { |
298 PlatformThread* tmpThread = _ptrThread.release(); | 292 rtc::PlatformThread* tmpThread = _ptrThread.release(); |
299 _critSect.Leave(); | 293 _critSect.Leave(); |
300 | 294 |
301 _timeEvent.Set(); | 295 _timeEvent.Set(); |
302 | 296 |
303 tmpThread->Stop(); | 297 tmpThread->Stop(); |
304 delete tmpThread; | 298 delete tmpThread; |
305 } | 299 } |
306 else | 300 else |
307 { | 301 { |
308 _critSect.Leave(); | 302 _critSect.Leave(); |
(...skipping 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3729 bool AudioDeviceWindowsWave::KeyPressed() const{ | 3723 bool AudioDeviceWindowsWave::KeyPressed() const{ |
3730 | 3724 |
3731 int key_down = 0; | 3725 int key_down = 0; |
3732 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) { | 3726 for (int key = VK_SPACE; key < VK_NUMLOCK; key++) { |
3733 short res = GetAsyncKeyState(key); | 3727 short res = GetAsyncKeyState(key); |
3734 key_down |= res & 0x1; // Get the LSB | 3728 key_down |= res & 0x1; // Get the LSB |
3735 } | 3729 } |
3736 return (key_down > 0); | 3730 return (key_down > 0); |
3737 } | 3731 } |
3738 } // namespace webrtc | 3732 } // namespace webrtc |
OLD | NEW |