From b0be7aa7aeca65bfeea49722339975b8184da0be Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Thu, 8 Dec 2011 20:15:36 +0000 Subject: [PATCH] Remove deprecated OS X Core Audio APIs. We no longer support the 10.4 SDK, so we can remove the weak-leaking feature and exclusively use the added-in-10.5 APIs. BUG=issue143 TEST=voe_auto_test Review URL: http://webrtc-codereview.appspot.com/322001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1136 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../main/source/mac/audio_device_mac.cc | 129 +++--------------- 1 file changed, 17 insertions(+), 112 deletions(-) diff --git a/src/modules/audio_device/main/source/mac/audio_device_mac.cc b/src/modules/audio_device/main/source/mac/audio_device_mac.cc index af857463e8..85dd8721fa 100644 --- a/src/modules/audio_device/main/source/mac/audio_device_mac.cc +++ b/src/modules/audio_device/main/source/mac/audio_device_mac.cc @@ -1638,19 +1638,8 @@ WebRtc_Word32 AudioDeviceMac::InitPlayout() if (_twoDevices || !_recIsInitialized) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_outputDeviceID, - deviceIOProc, this, &_deviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceAddIOProc(_outputDeviceID, deviceIOProc, this)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_outputDeviceID, + deviceIOProc, this, &_deviceIOProcID)); } // Mark playout side as initialized @@ -1868,36 +1857,12 @@ WebRtc_Word32 AudioDeviceMac::InitRecording() if (_twoDevices) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_inputDeviceID, - inDeviceIOProc, this, &_inDeviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceAddIOProc(_inputDeviceID, inDeviceIOProc, - this)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_inputDeviceID, + inDeviceIOProc, this, &_inDeviceIOProcID)); } else if (!_playIsInitialized) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_inputDeviceID, deviceIOProc, - this, &_deviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceAddIOProc(_inputDeviceID, deviceIOProc, - this)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceCreateIOProcID(_inputDeviceID, + deviceIOProc, this, &_deviceIOProcID)); } // Mark recording side as initialized @@ -1910,7 +1875,7 @@ WebRtc_Word32 AudioDeviceMac::StartRecording() { WEBRTC_TRACE(kTraceModuleCall, kTraceAudioDevice, _id, "%s", __FUNCTION__); - + CriticalSectionScoped lock(_critSect); if (!_recIsInitialized) @@ -1941,32 +1906,10 @@ WebRtc_Word32 AudioDeviceMac::StartRecording() if (_twoDevices) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _inDeviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, inDeviceIOProc)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _inDeviceIOProcID)); } else if (!_playing) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _deviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, deviceIOProc)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_inputDeviceID, _deviceIOProcID)); } _recording = true; @@ -2133,18 +2076,7 @@ WebRtc_Word32 AudioDeviceMac::StartPlayout() if (_twoDevices || !_recording) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_outputDeviceID, _deviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_outputDeviceID, deviceIOProc)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_RETURN_ON_ERR(AudioDeviceStart(_outputDeviceID, _deviceIOProcID)); } _playing = true; @@ -3043,24 +2975,10 @@ OSStatus AudioDeviceMac::implDeviceIOProc(const AudioBufferList *inputData, { // In the case of a shared device, the single driving ioProc // is stopped here -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_LOG_ERR(AudioDeviceStop(_outputDeviceID, - _deviceIOProcID)); - WEBRTC_CA_LOG_WARN(AudioDeviceDestroyIOProcID(_outputDeviceID, - _deviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_LOG_ERR(AudioDeviceStop(_outputDeviceID, - deviceIOProc)); - WEBRTC_CA_LOG_WARN(AudioDeviceRemoveIOProc(_outputDeviceID, - deviceIOProc)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_LOG_ERR(AudioDeviceStop(_outputDeviceID, + _deviceIOProcID)); + WEBRTC_CA_LOG_WARN(AudioDeviceDestroyIOProcID(_outputDeviceID, + _deviceIOProcID)); if (err == noErr) { WEBRTC_TRACE(kTraceDebug, kTraceAudioDevice, @@ -3164,22 +3082,9 @@ OSStatus AudioDeviceMac::implInDeviceIOProc(const AudioBufferList *inputData, if (_doStopRec) { // This will be signalled only when a shared device is not in use. -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - if (AudioDeviceCreateIOProcID != NULL) - { - WEBRTC_CA_LOG_ERR(AudioDeviceStop(_inputDeviceID, _inDeviceIOProcID)); - WEBRTC_CA_LOG_WARN(AudioDeviceDestroyIOProcID(_inputDeviceID, - _inDeviceIOProcID)); - } - else - { -#endif - WEBRTC_CA_LOG_ERR(AudioDeviceStop(_inputDeviceID, inDeviceIOProc)); - WEBRTC_CA_LOG_WARN(AudioDeviceRemoveIOProc(_inputDeviceID, - inDeviceIOProc)); -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1050 - } -#endif + WEBRTC_CA_LOG_ERR(AudioDeviceStop(_inputDeviceID, _inDeviceIOProcID)); + WEBRTC_CA_LOG_WARN(AudioDeviceDestroyIOProcID(_inputDeviceID, + _inDeviceIOProcID)); if (err == noErr) { WEBRTC_TRACE(kTraceDebug, kTraceAudioDevice,