- fixes for builds without resip/rutil integration

This commit is contained in:
Dmytro Bogovych 2018-08-13 14:03:12 +03:00
parent 018ddf81df
commit 76a0d93ef3
2 changed files with 13 additions and 12 deletions

View File

@ -80,7 +80,7 @@ CoreAudioUnit::CoreAudioUnit()
void CoreAudioUnit::open(bool voice) void CoreAudioUnit::open(bool voice)
{ {
OSStatus ostatus; OSStatus osstatus = 0;
#ifdef TARGET_IOS #ifdef TARGET_IOS
UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord; UInt32 audioCategory = kAudioSessionCategory_PlayAndRecord;
/* We want to be able to open playback and recording streams */ /* We want to be able to open playback and recording streams */
@ -95,7 +95,7 @@ void CoreAudioUnit::open(bool voice)
#endif #endif
// Locate audio component // Locate audio component
mUnit = NULL; mUnit = nullptr;
AudioComponentDescription desc; AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Output; desc.componentType = kAudioUnitType_Output;
#ifdef TARGET_IOS #ifdef TARGET_IOS
@ -107,19 +107,19 @@ void CoreAudioUnit::open(bool voice)
desc.componentFlags = 0; desc.componentFlags = 0;
desc.componentFlagsMask = 0; desc.componentFlagsMask = 0;
AudioComponent component = AudioComponentFindNext(NULL, &desc); AudioComponent component = AudioComponentFindNext(nullptr, &desc);
if (component == NULL) if (component == nullptr)
{ {
ICELogError(<< "Cannot find audio component, error " << int(ostatus)); ICELogError(<< "Cannot find audio component (null is returned)");
throw AudioException(ERR_COREAUDIO, ostatus); throw AudioException(ERR_COREAUDIO, osstatus);
} }
// Create audio unit // Create audio unit
ostatus = AudioComponentInstanceNew(component, &mUnit); osstatus = AudioComponentInstanceNew(component, &mUnit);
if (ostatus != noErr) if (osstatus != noErr)
{ {
ICELogError(<< "Cannot create audio component, error " << int(ostatus)); ICELogError(<< "Cannot create audio component, error " << int(osstatus));
throw AudioException(ERR_COREAUDIO, ostatus); throw AudioException(ERR_COREAUDIO, osstatus);
} }
} }
@ -129,7 +129,7 @@ void CoreAudioUnit::close()
{ {
AudioUnitUninitialize(mUnit); AudioUnitUninitialize(mUnit);
AudioComponentInstanceDispose(mUnit); AudioComponentInstanceDispose(mUnit);
mUnit = NULL; mUnit = nullptr;
} }
} }

View File

@ -17,6 +17,7 @@
#include "../helper/HL_ByteBuffer.h" #include "../helper/HL_ByteBuffer.h"
#include "../helper/HL_Exception.h" #include "../helper/HL_Exception.h"
#include <AudioToolbox/AudioQueue.h> #include <AudioToolbox/AudioQueue.h>
#include <memory>
// Define CoreAudio buffer time length in milliseconds // Define CoreAudio buffer time length in milliseconds
#define COREAUDIO_BUFFER_TIME 20 #define COREAUDIO_BUFFER_TIME 20
@ -152,7 +153,7 @@ protected:
}; };
typedef SharedPtr<MacDevice> PMacDevice; typedef std::shared_ptr<MacDevice> PMacDevice;
class MacInputDevice: public InputDevice class MacInputDevice: public InputDevice
{ {