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

Side by Side Diff: webrtc/modules/audio_device/mac/audio_device_mac.h

Issue 1476453002: Clean up PlatformThread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: IsRunning DCHECK 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
11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_MAC_H 11 #ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_MAC_H
12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_MAC_H 12 #define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_MAC_H
13 13
14 #include "webrtc/base/scoped_ptr.h" 14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/base/thread_annotations.h" 15 #include "webrtc/base/thread_annotations.h"
16 #include "webrtc/modules/audio_device/audio_device_generic.h" 16 #include "webrtc/modules/audio_device/audio_device_generic.h"
17 #include "webrtc/modules/audio_device/mac/audio_mixer_manager_mac.h" 17 #include "webrtc/modules/audio_device/mac/audio_mixer_manager_mac.h"
18 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 18 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
19 19
20 #include <AudioToolbox/AudioConverter.h> 20 #include <AudioToolbox/AudioConverter.h>
21 #include <CoreAudio/CoreAudio.h> 21 #include <CoreAudio/CoreAudio.h>
22 #include <mach/semaphore.h> 22 #include <mach/semaphore.h>
23 23
24 struct PaUtilRingBuffer; 24 struct PaUtilRingBuffer;
25 25
26 namespace rtc {
27 class PlatformThread;
28 } // namespace rtc
29
26 namespace webrtc 30 namespace webrtc
27 { 31 {
28 class EventWrapper; 32 class EventWrapper;
29 class PlatformThread;
30 33
31 const uint32_t N_REC_SAMPLES_PER_SEC = 48000; 34 const uint32_t N_REC_SAMPLES_PER_SEC = 48000;
32 const uint32_t N_PLAY_SAMPLES_PER_SEC = 48000; 35 const uint32_t N_PLAY_SAMPLES_PER_SEC = 48000;
33 36
34 const uint32_t N_REC_CHANNELS = 1; // default is mono recording 37 const uint32_t N_REC_CHANNELS = 1; // default is mono recording
35 const uint32_t N_PLAY_CHANNELS = 2; // default is stereo playout 38 const uint32_t N_PLAY_CHANNELS = 2; // default is stereo playout
36 const uint32_t N_DEVICE_CHANNELS = 64; 39 const uint32_t N_DEVICE_CHANNELS = 64;
37 40
38 const uint32_t ENGINE_REC_BUF_SIZE_IN_SAMPLES = (N_REC_SAMPLES_PER_SEC / 100); 41 const uint32_t ENGINE_REC_BUF_SIZE_IN_SAMPLES = (N_REC_SAMPLES_PER_SEC / 100);
39 const uint32_t ENGINE_PLAY_BUF_SIZE_IN_SAMPLES = (N_PLAY_SAMPLES_PER_SEC / 100); 42 const uint32_t ENGINE_PLAY_BUF_SIZE_IN_SAMPLES = (N_PLAY_SAMPLES_PER_SEC / 100);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 278
276 bool KeyPressed(); 279 bool KeyPressed();
277 280
278 AudioDeviceBuffer* _ptrAudioBuffer; 281 AudioDeviceBuffer* _ptrAudioBuffer;
279 282
280 CriticalSectionWrapper& _critSect; 283 CriticalSectionWrapper& _critSect;
281 284
282 EventWrapper& _stopEventRec; 285 EventWrapper& _stopEventRec;
283 EventWrapper& _stopEvent; 286 EventWrapper& _stopEvent;
284 287
288 // TODO(pbos): Replace with direct members, just start/stop, no need to
289 // recreate the thread.
285 // Only valid/running between calls to StartRecording and StopRecording. 290 // Only valid/running between calls to StartRecording and StopRecording.
286 rtc::scoped_ptr<PlatformThread> capture_worker_thread_; 291 rtc::scoped_ptr<rtc::PlatformThread> capture_worker_thread_;
287 292
288 // Only valid/running between calls to StartPlayout and StopPlayout. 293 // Only valid/running between calls to StartPlayout and StopPlayout.
289 rtc::scoped_ptr<PlatformThread> render_worker_thread_; 294 rtc::scoped_ptr<rtc::PlatformThread> render_worker_thread_;
290 295
291 int32_t _id; 296 int32_t _id;
292 297
293 AudioMixerManagerMac _mixerManager; 298 AudioMixerManagerMac _mixerManager;
294 299
295 uint16_t _inputDeviceIndex; 300 uint16_t _inputDeviceIndex;
296 uint16_t _outputDeviceIndex; 301 uint16_t _outputDeviceIndex;
297 AudioDeviceID _inputDeviceID; 302 AudioDeviceID _inputDeviceID;
298 AudioDeviceID _outputDeviceID; 303 AudioDeviceID _outputDeviceID;
299 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 304 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 int _renderBufSizeSamples; 370 int _renderBufSizeSamples;
366 371
367 // Typing detection 372 // Typing detection
368 // 0x5c is key "9", after that comes function keys. 373 // 0x5c is key "9", after that comes function keys.
369 bool prev_key_state_[0x5d]; 374 bool prev_key_state_[0x5d];
370 }; 375 };
371 376
372 } // namespace webrtc 377 } // namespace webrtc
373 378
374 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_ 379 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/linux/audio_device_pulse_linux.cc ('k') | webrtc/modules/audio_device/mac/audio_device_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698