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

Side by Side Diff: webrtc/modules/audio_device/dummy/file_audio_device.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 #include "webrtc/base/platform_thread.h"
10 #include "webrtc/modules/audio_device/dummy/file_audio_device.h" 11 #include "webrtc/modules/audio_device/dummy/file_audio_device.h"
11 #include "webrtc/system_wrappers/include/sleep.h" 12 #include "webrtc/system_wrappers/include/sleep.h"
12 #include "webrtc/system_wrappers/include/thread_wrapper.h"
13 13
14 namespace webrtc { 14 namespace webrtc {
15 15
16 const int kRecordingFixedSampleRate = 48000; 16 const int kRecordingFixedSampleRate = 48000;
17 const int kRecordingNumChannels = 2; 17 const int kRecordingNumChannels = 2;
18 const int kPlayoutFixedSampleRate = 48000; 18 const int kPlayoutFixedSampleRate = 48000;
19 const int kPlayoutNumChannels = 2; 19 const int kPlayoutNumChannels = 2;
20 const int kPlayoutBufferSize = kPlayoutFixedSampleRate / 100 20 const int kPlayoutBufferSize = kPlayoutFixedSampleRate / 100
21 * kPlayoutNumChannels * 2; 21 * kPlayoutNumChannels * 2;
22 const int kRecordingBufferSize = kRecordingFixedSampleRate / 100 22 const int kRecordingBufferSize = kRecordingFixedSampleRate / 100
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 if (!_outputFilename.empty() && _outputFile.OpenFile( 207 if (!_outputFilename.empty() && _outputFile.OpenFile(
208 _outputFilename.c_str(), false, false, false) == -1) { 208 _outputFilename.c_str(), false, false, false) == -1) {
209 printf("Failed to open playout file %s!\n", _outputFilename.c_str()); 209 printf("Failed to open playout file %s!\n", _outputFilename.c_str());
210 _playing = false; 210 _playing = false;
211 delete [] _playoutBuffer; 211 delete [] _playoutBuffer;
212 _playoutBuffer = NULL; 212 _playoutBuffer = NULL;
213 return -1; 213 return -1;
214 } 214 }
215 215
216 const char* threadName = "webrtc_audio_module_play_thread"; 216 const char* threadName = "webrtc_audio_module_play_thread";
217 _ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this, 217 _ptrThreadPlay =
218 threadName); 218 PlatformThread::CreateThread(PlayThreadFunc, this, threadName);
219 if (!_ptrThreadPlay->Start()) { 219 if (!_ptrThreadPlay->Start()) {
220 _ptrThreadPlay.reset(); 220 _ptrThreadPlay.reset();
221 _playing = false; 221 _playing = false;
222 delete [] _playoutBuffer; 222 delete [] _playoutBuffer;
223 _playoutBuffer = NULL; 223 _playoutBuffer = NULL;
224 return -1; 224 return -1;
225 } 225 }
226 _ptrThreadPlay->SetPriority(kRealtimePriority); 226 _ptrThreadPlay->SetPriority(kRealtimePriority);
227 return 0; 227 return 0;
228 } 228 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 _inputFilename.c_str(), true, true, false) == -1) { 270 _inputFilename.c_str(), true, true, false) == -1) {
271 printf("Failed to open audio input file %s!\n", 271 printf("Failed to open audio input file %s!\n",
272 _inputFilename.c_str()); 272 _inputFilename.c_str());
273 _recording = false; 273 _recording = false;
274 delete[] _recordingBuffer; 274 delete[] _recordingBuffer;
275 _recordingBuffer = NULL; 275 _recordingBuffer = NULL;
276 return -1; 276 return -1;
277 } 277 }
278 278
279 const char* threadName = "webrtc_audio_module_capture_thread"; 279 const char* threadName = "webrtc_audio_module_capture_thread";
280 _ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc, this, threadName); 280 _ptrThreadRec = PlatformThread::CreateThread(RecThreadFunc, this, threadName);
281 281
282 if (!_ptrThreadRec->Start()) { 282 if (!_ptrThreadRec->Start()) {
283 _ptrThreadRec.reset(); 283 _ptrThreadRec.reset();
284 _recording = false; 284 _recording = false;
285 delete [] _recordingBuffer; 285 delete [] _recordingBuffer;
286 _recordingBuffer = NULL; 286 _recordingBuffer = NULL;
287 return -1; 287 return -1;
288 } 288 }
289 _ptrThreadRec->SetPriority(kRealtimePriority); 289 _ptrThreadRec->SetPriority(kRealtimePriority);
290 290
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 _critSect.Enter(); 541 _critSect.Enter();
542 } 542 }
543 } 543 }
544 544
545 _critSect.Leave(); 545 _critSect.Leave();
546 SleepMs(10 - (_clock->CurrentNtpInMilliseconds() - currentTime)); 546 SleepMs(10 - (_clock->CurrentNtpInMilliseconds() - currentTime));
547 return true; 547 return true;
548 } 548 }
549 549
550 } // namespace webrtc 550 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/dummy/file_audio_device.h ('k') | webrtc/modules/audio_device/linux/audio_device_alsa_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698