From 76a0d93ef306cac5b21a22a3caf37c13e7166b32 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Mon, 13 Aug 2018 14:03:12 +0300 Subject: [PATCH] - fixes for builds without resip/rutil integration --- src/engine/audio/Audio_CoreAudio.cpp | 22 +++++++++++----------- src/engine/audio/Audio_CoreAudio.h | 3 ++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/engine/audio/Audio_CoreAudio.cpp b/src/engine/audio/Audio_CoreAudio.cpp index 02e9aed0..4d465e97 100644 --- a/src/engine/audio/Audio_CoreAudio.cpp +++ b/src/engine/audio/Audio_CoreAudio.cpp @@ -80,7 +80,7 @@ CoreAudioUnit::CoreAudioUnit() void CoreAudioUnit::open(bool voice) { - OSStatus ostatus; + OSStatus osstatus = 0; #ifdef TARGET_IOS UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord; /* We want to be able to open playback and recording streams */ @@ -95,7 +95,7 @@ void CoreAudioUnit::open(bool voice) #endif // Locate audio component - mUnit = NULL; + mUnit = nullptr; AudioComponentDescription desc; desc.componentType = kAudioUnitType_Output; #ifdef TARGET_IOS @@ -107,19 +107,19 @@ void CoreAudioUnit::open(bool voice) desc.componentFlags = 0; desc.componentFlagsMask = 0; - AudioComponent component = AudioComponentFindNext(NULL, &desc); - if (component == NULL) + AudioComponent component = AudioComponentFindNext(nullptr, &desc); + if (component == nullptr) { - ICELogError(<< "Cannot find audio component, error " << int(ostatus)); - throw AudioException(ERR_COREAUDIO, ostatus); + ICELogError(<< "Cannot find audio component (null is returned)"); + throw AudioException(ERR_COREAUDIO, osstatus); } // Create audio unit - ostatus = AudioComponentInstanceNew(component, &mUnit); - if (ostatus != noErr) + osstatus = AudioComponentInstanceNew(component, &mUnit); + if (osstatus != noErr) { - ICELogError(<< "Cannot create audio component, error " << int(ostatus)); - throw AudioException(ERR_COREAUDIO, ostatus); + ICELogError(<< "Cannot create audio component, error " << int(osstatus)); + throw AudioException(ERR_COREAUDIO, osstatus); } } @@ -129,7 +129,7 @@ void CoreAudioUnit::close() { AudioUnitUninitialize(mUnit); AudioComponentInstanceDispose(mUnit); - mUnit = NULL; + mUnit = nullptr; } } diff --git a/src/engine/audio/Audio_CoreAudio.h b/src/engine/audio/Audio_CoreAudio.h index f787f532..792b98a0 100644 --- a/src/engine/audio/Audio_CoreAudio.h +++ b/src/engine/audio/Audio_CoreAudio.h @@ -17,6 +17,7 @@ #include "../helper/HL_ByteBuffer.h" #include "../helper/HL_Exception.h" #include +#include // Define CoreAudio buffer time length in milliseconds #define COREAUDIO_BUFFER_TIME 20 @@ -152,7 +153,7 @@ protected: }; -typedef SharedPtr PMacDevice; +typedef std::shared_ptr PMacDevice; class MacInputDevice: public InputDevice {