| 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 |
| 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 <memory> | 14 #include <memory> |
| 15 | 15 |
| 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/rtc_base/criticalsection.h" | 18 #include "webrtc/rtc_base/criticalsection.h" |
| 19 #include "webrtc/rtc_base/logging.h" |
| 19 #include "webrtc/rtc_base/thread_annotations.h" | 20 #include "webrtc/rtc_base/thread_annotations.h" |
| 20 #include "webrtc/system_wrappers/include/event_wrapper.h" | 21 #include "webrtc/system_wrappers/include/event_wrapper.h" |
| 21 | 22 |
| 22 #include <AudioToolbox/AudioConverter.h> | 23 #include <AudioToolbox/AudioConverter.h> |
| 23 #include <CoreAudio/CoreAudio.h> | 24 #include <CoreAudio/CoreAudio.h> |
| 24 #include <mach/semaphore.h> | 25 #include <mach/semaphore.h> |
| 25 | 26 |
| 26 struct PaUtilRingBuffer; | 27 struct PaUtilRingBuffer; |
| 27 | 28 |
| 28 namespace rtc { | 29 namespace rtc { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 54 | 55 |
| 55 const uint32_t REC_BUF_SIZE_IN_SAMPLES = | 56 const uint32_t REC_BUF_SIZE_IN_SAMPLES = |
| 56 ENGINE_REC_BUF_SIZE_IN_SAMPLES * N_DEVICE_CHANNELS * N_BUFFERS_IN; | 57 ENGINE_REC_BUF_SIZE_IN_SAMPLES * N_DEVICE_CHANNELS * N_BUFFERS_IN; |
| 57 const uint32_t PLAY_BUF_SIZE_IN_SAMPLES = | 58 const uint32_t PLAY_BUF_SIZE_IN_SAMPLES = |
| 58 ENGINE_PLAY_BUF_SIZE_IN_SAMPLES * N_PLAY_CHANNELS * N_BUFFERS_OUT; | 59 ENGINE_PLAY_BUF_SIZE_IN_SAMPLES * N_PLAY_CHANNELS * N_BUFFERS_OUT; |
| 59 | 60 |
| 60 const int kGetMicVolumeIntervalMs = 1000; | 61 const int kGetMicVolumeIntervalMs = 1000; |
| 61 | 62 |
| 62 class AudioDeviceMac : public AudioDeviceGeneric { | 63 class AudioDeviceMac : public AudioDeviceGeneric { |
| 63 public: | 64 public: |
| 64 AudioDeviceMac(const int32_t id); | 65 AudioDeviceMac(); |
| 65 ~AudioDeviceMac(); | 66 ~AudioDeviceMac(); |
| 66 | 67 |
| 67 // Retrieve the currently utilized audio layer | 68 // Retrieve the currently utilized audio layer |
| 68 virtual int32_t ActiveAudioLayer( | 69 virtual int32_t ActiveAudioLayer( |
| 69 AudioDeviceModule::AudioLayer& audioLayer) const; | 70 AudioDeviceModule::AudioLayer& audioLayer) const; |
| 70 | 71 |
| 71 // Main initializaton and termination | 72 // Main initializaton and termination |
| 72 virtual InitStatus Init(); | 73 virtual InitStatus Init(); |
| 73 virtual int32_t Terminate(); | 74 virtual int32_t Terminate(); |
| 74 virtual bool Initialized() const; | 75 virtual bool Initialized() const; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 183 |
| 183 virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer); | 184 virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer); |
| 184 | 185 |
| 185 private: | 186 private: |
| 186 virtual int32_t MicrophoneIsAvailable(bool& available); | 187 virtual int32_t MicrophoneIsAvailable(bool& available); |
| 187 virtual int32_t SpeakerIsAvailable(bool& available); | 188 virtual int32_t SpeakerIsAvailable(bool& available); |
| 188 | 189 |
| 189 static void AtomicSet32(int32_t* theValue, int32_t newValue); | 190 static void AtomicSet32(int32_t* theValue, int32_t newValue); |
| 190 static int32_t AtomicGet32(int32_t* theValue); | 191 static int32_t AtomicGet32(int32_t* theValue); |
| 191 | 192 |
| 192 static void logCAMsg(const TraceLevel level, | 193 static void logCAMsg(const rtc::LoggingSeverity sev, |
| 193 const TraceModule module, | |
| 194 const int32_t id, | |
| 195 const char* msg, | 194 const char* msg, |
| 196 const char* err); | 195 const char* err); |
| 197 | 196 |
| 198 int32_t GetNumberDevices(const AudioObjectPropertyScope scope, | 197 int32_t GetNumberDevices(const AudioObjectPropertyScope scope, |
| 199 AudioDeviceID scopedDeviceIds[], | 198 AudioDeviceID scopedDeviceIds[], |
| 200 const uint32_t deviceListLength); | 199 const uint32_t deviceListLength); |
| 201 | 200 |
| 202 int32_t GetDeviceName(const AudioObjectPropertyScope scope, | 201 int32_t GetDeviceName(const AudioObjectPropertyScope scope, |
| 203 const uint16_t index, | 202 const uint16_t index, |
| 204 char* name); | 203 char* name); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 EventWrapper& _stopEvent; | 289 EventWrapper& _stopEvent; |
| 291 | 290 |
| 292 // TODO(pbos): Replace with direct members, just start/stop, no need to | 291 // TODO(pbos): Replace with direct members, just start/stop, no need to |
| 293 // recreate the thread. | 292 // recreate the thread. |
| 294 // Only valid/running between calls to StartRecording and StopRecording. | 293 // Only valid/running between calls to StartRecording and StopRecording. |
| 295 std::unique_ptr<rtc::PlatformThread> capture_worker_thread_; | 294 std::unique_ptr<rtc::PlatformThread> capture_worker_thread_; |
| 296 | 295 |
| 297 // Only valid/running between calls to StartPlayout and StopPlayout. | 296 // Only valid/running between calls to StartPlayout and StopPlayout. |
| 298 std::unique_ptr<rtc::PlatformThread> render_worker_thread_; | 297 std::unique_ptr<rtc::PlatformThread> render_worker_thread_; |
| 299 | 298 |
| 300 int32_t _id; | |
| 301 | |
| 302 AudioMixerManagerMac _mixerManager; | 299 AudioMixerManagerMac _mixerManager; |
| 303 | 300 |
| 304 uint16_t _inputDeviceIndex; | 301 uint16_t _inputDeviceIndex; |
| 305 uint16_t _outputDeviceIndex; | 302 uint16_t _outputDeviceIndex; |
| 306 AudioDeviceID _inputDeviceID; | 303 AudioDeviceID _inputDeviceID; |
| 307 AudioDeviceID _outputDeviceID; | 304 AudioDeviceID _outputDeviceID; |
| 308 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 | 305 #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 |
| 309 AudioDeviceIOProcID _inDeviceIOProcID; | 306 AudioDeviceIOProcID _inDeviceIOProcID; |
| 310 AudioDeviceIOProcID _deviceIOProcID; | 307 AudioDeviceIOProcID _deviceIOProcID; |
| 311 #endif | 308 #endif |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // Typing detection | 373 // Typing detection |
| 377 // 0x5c is key "9", after that comes function keys. | 374 // 0x5c is key "9", after that comes function keys. |
| 378 bool prev_key_state_[0x5d]; | 375 bool prev_key_state_[0x5d]; |
| 379 | 376 |
| 380 int get_mic_volume_counter_ms_; | 377 int get_mic_volume_counter_ms_; |
| 381 }; | 378 }; |
| 382 | 379 |
| 383 } // namespace webrtc | 380 } // namespace webrtc |
| 384 | 381 |
| 385 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_ | 382 #endif // MODULES_AUDIO_DEVICE_MAIN_SOURCE_MAC_AUDIO_DEVICE_MAC_H_ |
| OLD | NEW |