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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 //Get X display handle for typing detection | 194 //Get X display handle for typing detection |
195 _XDisplay = XOpenDisplay(NULL); | 195 _XDisplay = XOpenDisplay(NULL); |
196 if (!_XDisplay) | 196 if (!_XDisplay) |
197 { | 197 { |
198 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, | 198 WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, |
199 " failed to open X display, typing detection will not work"); | 199 " failed to open X display, typing detection will not work"); |
200 } | 200 } |
201 | 201 |
202 // RECORDING | 202 // RECORDING |
203 const char* threadName = "webrtc_audio_module_rec_thread"; | 203 const char* threadName = "webrtc_audio_module_rec_thread"; |
204 _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc, this, | 204 _ptrThreadRec = |
205 threadName); | 205 PlatformThread::CreateThread(RecThreadFunc, this, threadName); |
206 if (!_ptrThreadRec->Start()) | 206 if (!_ptrThreadRec->Start()) |
207 { | 207 { |
208 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, | 208 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
209 " failed to start the rec audio thread"); | 209 " failed to start the rec audio thread"); |
210 | 210 |
211 _ptrThreadRec.reset(); | 211 _ptrThreadRec.reset(); |
212 return -1; | 212 return -1; |
213 } | 213 } |
214 | 214 |
215 _ptrThreadRec->SetPriority(kRealtimePriority); | 215 _ptrThreadRec->SetPriority(kRealtimePriority); |
216 | 216 |
217 // PLAYOUT | 217 // PLAYOUT |
218 threadName = "webrtc_audio_module_play_thread"; | 218 threadName = "webrtc_audio_module_play_thread"; |
219 _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this, | 219 _ptrThreadPlay = |
220 threadName); | 220 PlatformThread::CreateThread(PlayThreadFunc, this, threadName); |
221 if (!_ptrThreadPlay->Start()) | 221 if (!_ptrThreadPlay->Start()) |
222 { | 222 { |
223 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, | 223 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, |
224 " failed to start the play audio thread"); | 224 " failed to start the play audio thread"); |
225 | 225 |
226 _ptrThreadPlay.reset(); | 226 _ptrThreadPlay.reset(); |
227 return -1; | 227 return -1; |
228 } | 228 } |
229 _ptrThreadPlay->SetPriority(kRealtimePriority); | 229 _ptrThreadPlay->SetPriority(kRealtimePriority); |
230 | 230 |
231 _initialized = true; | 231 _initialized = true; |
232 | 232 |
233 return 0; | 233 return 0; |
234 } | 234 } |
235 | 235 |
236 int32_t AudioDeviceLinuxPulse::Terminate() | 236 int32_t AudioDeviceLinuxPulse::Terminate() |
237 { | 237 { |
238 RTC_DCHECK(thread_checker_.CalledOnValidThread()); | 238 RTC_DCHECK(thread_checker_.CalledOnValidThread()); |
239 if (!_initialized) | 239 if (!_initialized) |
240 { | 240 { |
241 return 0; | 241 return 0; |
242 } | 242 } |
243 | 243 |
244 _mixerManager.Close(); | 244 _mixerManager.Close(); |
245 | 245 |
246 // RECORDING | 246 // RECORDING |
247 if (_ptrThreadRec) | 247 if (_ptrThreadRec) |
248 { | 248 { |
249 ThreadWrapper* tmpThread = _ptrThreadRec.release(); | 249 PlatformThread* tmpThread = _ptrThreadRec.release(); |
250 | 250 |
251 _timeEventRec.Set(); | 251 _timeEventRec.Set(); |
252 tmpThread->Stop(); | 252 tmpThread->Stop(); |
253 delete tmpThread; | 253 delete tmpThread; |
254 } | 254 } |
255 | 255 |
256 // PLAYOUT | 256 // PLAYOUT |
257 if (_ptrThreadPlay) | 257 if (_ptrThreadPlay) |
258 { | 258 { |
259 ThreadWrapper* tmpThread = _ptrThreadPlay.release(); | 259 PlatformThread* tmpThread = _ptrThreadPlay.release(); |
260 | 260 |
261 _timeEventPlay.Set(); | 261 _timeEventPlay.Set(); |
262 tmpThread->Stop(); | 262 tmpThread->Stop(); |
263 delete tmpThread; | 263 delete tmpThread; |
264 } | 264 } |
265 | 265 |
266 // Terminate PulseAudio | 266 // Terminate PulseAudio |
267 if (TerminatePulseAudio() < 0) | 267 if (TerminatePulseAudio() < 0) |
268 { | 268 { |
269 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, | 269 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, |
(...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3013 | 3013 |
3014 // A bit change in keymap means a key is pressed | 3014 // A bit change in keymap means a key is pressed |
3015 for (i = 0; i < sizeof(szKey); i++) | 3015 for (i = 0; i < sizeof(szKey); i++) |
3016 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; | 3016 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; |
3017 | 3017 |
3018 // Save old state | 3018 // Save old state |
3019 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); | 3019 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); |
3020 return (state != 0); | 3020 return (state != 0); |
3021 } | 3021 } |
3022 } | 3022 } |
OLD | NEW |