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

Side by Side Diff: webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc

Issue 1469013002: Move ThreadWrapper to ProcessThread in base. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: removed comment Created 5 years 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return 0; 200 return 0;
201 } 201 }
202 202
203 CriticalSectionScoped lock(&_critSect); 203 CriticalSectionScoped lock(&_critSect);
204 204
205 _mixerManager.Close(); 205 _mixerManager.Close();
206 206
207 // RECORDING 207 // RECORDING
208 if (_ptrThreadRec) 208 if (_ptrThreadRec)
209 { 209 {
210 ThreadWrapper* tmpThread = _ptrThreadRec.release(); 210 PlatformThread* tmpThread = _ptrThreadRec.release();
211 _critSect.Leave(); 211 _critSect.Leave();
212 212
213 tmpThread->Stop(); 213 tmpThread->Stop();
214 delete tmpThread; 214 delete tmpThread;
215 215
216 _critSect.Enter(); 216 _critSect.Enter();
217 } 217 }
218 218
219 // PLAYOUT 219 // PLAYOUT
220 if (_ptrThreadPlay) 220 if (_ptrThreadPlay)
221 { 221 {
222 ThreadWrapper* tmpThread = _ptrThreadPlay.release(); 222 PlatformThread* tmpThread = _ptrThreadPlay.release();
223 _critSect.Leave(); 223 _critSect.Leave();
224 224
225 tmpThread->Stop(); 225 tmpThread->Stop();
226 delete tmpThread; 226 delete tmpThread;
227 227
228 _critSect.Enter(); 228 _critSect.Enter();
229 } 229 }
230 #if defined(USE_X11) 230 #if defined(USE_X11)
231 if (_XDisplay) 231 if (_XDisplay)
232 { 232 {
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 _recordingBuffer = new int8_t[_recordingBufferSizeIn10MS]; 1357 _recordingBuffer = new int8_t[_recordingBufferSizeIn10MS];
1358 if (!_recordingBuffer) 1358 if (!_recordingBuffer)
1359 { 1359 {
1360 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, 1360 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
1361 " failed to alloc recording buffer"); 1361 " failed to alloc recording buffer");
1362 _recording = false; 1362 _recording = false;
1363 return -1; 1363 return -1;
1364 } 1364 }
1365 // RECORDING 1365 // RECORDING
1366 const char* threadName = "webrtc_audio_module_capture_thread"; 1366 const char* threadName = "webrtc_audio_module_capture_thread";
1367 _ptrThreadRec = ThreadWrapper::CreateThread( 1367 _ptrThreadRec =
1368 RecThreadFunc, this, threadName); 1368 PlatformThread::CreateThread(RecThreadFunc, this, threadName);
1369 1369
1370 if (!_ptrThreadRec->Start()) 1370 if (!_ptrThreadRec->Start())
1371 { 1371 {
1372 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, 1372 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
1373 " failed to start the rec audio thread"); 1373 " failed to start the rec audio thread");
1374 _recording = false; 1374 _recording = false;
1375 _ptrThreadRec.reset(); 1375 _ptrThreadRec.reset();
1376 delete [] _recordingBuffer; 1376 delete [] _recordingBuffer;
1377 _recordingBuffer = NULL; 1377 _recordingBuffer = NULL;
1378 return -1; 1378 return -1;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 if (!_playoutBuffer) 1511 if (!_playoutBuffer)
1512 { 1512 {
1513 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, 1513 WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
1514 " failed to alloc playout buf"); 1514 " failed to alloc playout buf");
1515 _playing = false; 1515 _playing = false;
1516 return -1; 1516 return -1;
1517 } 1517 }
1518 1518
1519 // PLAYOUT 1519 // PLAYOUT
1520 const char* threadName = "webrtc_audio_module_play_thread"; 1520 const char* threadName = "webrtc_audio_module_play_thread";
1521 _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this, 1521 _ptrThreadPlay =
1522 threadName); 1522 PlatformThread::CreateThread(PlayThreadFunc, this, threadName);
1523 if (!_ptrThreadPlay->Start()) 1523 if (!_ptrThreadPlay->Start())
1524 { 1524 {
1525 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, 1525 WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
1526 " failed to start the play audio thread"); 1526 " failed to start the play audio thread");
1527 _playing = false; 1527 _playing = false;
1528 _ptrThreadPlay.reset(); 1528 _ptrThreadPlay.reset();
1529 delete [] _playoutBuffer; 1529 delete [] _playoutBuffer;
1530 _playoutBuffer = NULL; 1530 _playoutBuffer = NULL;
1531 return -1; 1531 return -1;
1532 } 1532 }
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i]; 2238 state |= (szKey[i] ^ _oldKeyState[i]) & szKey[i];
2239 2239
2240 // Save old state 2240 // Save old state
2241 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState)); 2241 memcpy((char*)_oldKeyState, (char*)szKey, sizeof(_oldKeyState));
2242 return (state != 0); 2242 return (state != 0);
2243 #else 2243 #else
2244 return false; 2244 return false;
2245 #endif 2245 #endif
2246 } 2246 }
2247 } // namespace webrtc 2247 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698