| Index: webrtc/modules/audio_device/mac/audio_device_mac.cc
|
| diff --git a/webrtc/modules/audio_device/mac/audio_device_mac.cc b/webrtc/modules/audio_device/mac/audio_device_mac.cc
|
| index 77897a2df4b1f997592aa1996355b9e1286bf315..622e321e00e76e198e63c606b0425ee1f9f998df 100644
|
| --- a/webrtc/modules/audio_device/mac/audio_device_mac.cc
|
| +++ b/webrtc/modules/audio_device/mac/audio_device_mac.cc
|
| @@ -79,8 +79,8 @@ void AudioDeviceMac::logCAMsg(const TraceLevel level,
|
| const int32_t id,
|
| const char* msg,
|
| const char* err) {
|
| - RTC_DCHECK(msg != NULL);
|
| - RTC_DCHECK(err != NULL);
|
| + RTC_DCHECK(msg != nullptr);
|
| + RTC_DCHECK(err != nullptr);
|
|
|
| #ifdef WEBRTC_ARCH_BIG_ENDIAN
|
| WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err);
|
| @@ -92,7 +92,7 @@ void AudioDeviceMac::logCAMsg(const TraceLevel level,
|
| }
|
|
|
| AudioDeviceMac::AudioDeviceMac(const int32_t id)
|
| - : _ptrAudioBuffer(NULL),
|
| + : _ptrAudioBuffer(nullptr),
|
| _critSect(*CriticalSectionWrapper::CreateCriticalSection()),
|
| _stopEventRec(*EventWrapper::Create()),
|
| _stopEvent(*EventWrapper::Create()),
|
| @@ -106,8 +106,8 @@ AudioDeviceMac::AudioDeviceMac(const int32_t id)
|
| _outputDeviceIsSpecified(false),
|
| _recChannels(N_REC_CHANNELS),
|
| _playChannels(N_PLAY_CHANNELS),
|
| - _captureBufData(NULL),
|
| - _renderBufData(NULL),
|
| + _captureBufData(nullptr),
|
| + _renderBufData(nullptr),
|
| _playBufType(AudioDeviceModule::kFixedBufferSize),
|
| _initialized(false),
|
| _isShutDown(false),
|
| @@ -133,16 +133,16 @@ AudioDeviceMac::AudioDeviceMac(const int32_t id)
|
| _playError(0),
|
| _recWarning(0),
|
| _recError(0),
|
| - _paCaptureBuffer(NULL),
|
| - _paRenderBuffer(NULL),
|
| + _paCaptureBuffer(nullptr),
|
| + _paRenderBuffer(nullptr),
|
| _captureBufSizeSamples(0),
|
| _renderBufSizeSamples(0),
|
| prev_key_state_(),
|
| get_mic_volume_counter_ms_(0) {
|
| WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, "%s created", __FUNCTION__);
|
|
|
| - RTC_DCHECK(&_stopEvent != NULL);
|
| - RTC_DCHECK(&_stopEventRec != NULL);
|
| + RTC_DCHECK(&_stopEvent);
|
| + RTC_DCHECK(&_stopEventRec);
|
|
|
| memset(_renderConvertData, 0, sizeof(_renderConvertData));
|
| memset(&_outStreamFormat, 0, sizeof(AudioStreamBasicDescription));
|
| @@ -164,22 +164,22 @@ AudioDeviceMac::~AudioDeviceMac() {
|
|
|
| if (_paRenderBuffer) {
|
| delete _paRenderBuffer;
|
| - _paRenderBuffer = NULL;
|
| + _paRenderBuffer = nullptr;
|
| }
|
|
|
| if (_paCaptureBuffer) {
|
| delete _paCaptureBuffer;
|
| - _paCaptureBuffer = NULL;
|
| + _paCaptureBuffer = nullptr;
|
| }
|
|
|
| if (_renderBufData) {
|
| delete[] _renderBufData;
|
| - _renderBufData = NULL;
|
| + _renderBufData = nullptr;
|
| }
|
|
|
| if (_captureBufData) {
|
| delete[] _captureBufData;
|
| - _captureBufData = NULL;
|
| + _captureBufData = nullptr;
|
| }
|
|
|
| kern_return_t kernErr = KERN_SUCCESS;
|
| @@ -234,7 +234,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| _isShutDown = false;
|
|
|
| // PortAudio ring buffers require an elementCount which is a power of two.
|
| - if (_renderBufData == NULL) {
|
| + if (_renderBufData == nullptr) {
|
| UInt32 powerOfTwo = 1;
|
| while (powerOfTwo < PLAY_BUF_SIZE_IN_SAMPLES) {
|
| powerOfTwo <<= 1;
|
| @@ -243,7 +243,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| _renderBufData = new SInt16[_renderBufSizeSamples];
|
| }
|
|
|
| - if (_paRenderBuffer == NULL) {
|
| + if (_paRenderBuffer == nullptr) {
|
| _paRenderBuffer = new PaUtilRingBuffer;
|
| PaRingBufferSize bufSize = -1;
|
| bufSize = PaUtil_InitializeRingBuffer(
|
| @@ -255,7 +255,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| }
|
| }
|
|
|
| - if (_captureBufData == NULL) {
|
| + if (_captureBufData == nullptr) {
|
| UInt32 powerOfTwo = 1;
|
| while (powerOfTwo < REC_BUF_SIZE_IN_SAMPLES) {
|
| powerOfTwo <<= 1;
|
| @@ -264,7 +264,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| _captureBufData = new Float32[_captureBufSizeSamples];
|
| }
|
|
|
| - if (_paCaptureBuffer == NULL) {
|
| + if (_paCaptureBuffer == nullptr) {
|
| _paCaptureBuffer = new PaUtilRingBuffer;
|
| PaRingBufferSize bufSize = -1;
|
| bufSize =
|
| @@ -294,17 +294,17 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| return InitStatus::OTHER_ERROR;
|
| }
|
|
|
| - // Setting RunLoop to NULL here instructs HAL to manage its own thread for
|
| + // Setting RunLoop to null here instructs HAL to manage its own thread for
|
| // notifications. This was the default behaviour on OS X 10.5 and earlier,
|
| // but now must be explicitly specified. HAL would otherwise try to use the
|
| // main thread to issue notifications.
|
| AudioObjectPropertyAddress propertyAddress = {
|
| kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal,
|
| kAudioObjectPropertyElementMaster};
|
| - CFRunLoopRef runLoop = NULL;
|
| + CFRunLoopRef runLoop = nullptr;
|
| UInt32 size = sizeof(CFRunLoopRef);
|
| int aoerr = AudioObjectSetPropertyData(
|
| - kAudioObjectSystemObject, &propertyAddress, 0, NULL, size, &runLoop);
|
| + kAudioObjectSystemObject, &propertyAddress, 0, nullptr, size, &runLoop);
|
| if (aoerr != noErr) {
|
| LOG(LS_ERROR) << "Error in AudioObjectSetPropertyData: "
|
| << (const char*)&aoerr;
|
| @@ -323,7 +323,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceMac::Init() {
|
| size_t length = sizeof(buf);
|
| memset(buf, 0, length);
|
|
|
| - int intErr = sysctlbyname("hw.model", buf, &length, NULL, 0);
|
| + int intErr = sysctlbyname("hw.model", buf, &length, nullptr, 0);
|
| if (intErr != 0) {
|
| WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
|
| " Error in sysctlbyname(): %d", err);
|
| @@ -938,13 +938,13 @@ int32_t AudioDeviceMac::PlayoutDeviceName(uint16_t index,
|
| char guid[kAdmMaxGuidSize]) {
|
| const uint16_t nDevices(PlayoutDevices());
|
|
|
| - if ((index > (nDevices - 1)) || (name == NULL)) {
|
| + if ((index > (nDevices - 1)) || (name == nullptr)) {
|
| return -1;
|
| }
|
|
|
| memset(name, 0, kAdmMaxDeviceNameSize);
|
|
|
| - if (guid != NULL) {
|
| + if (guid != nullptr) {
|
| memset(guid, 0, kAdmMaxGuidSize);
|
| }
|
|
|
| @@ -956,13 +956,13 @@ int32_t AudioDeviceMac::RecordingDeviceName(uint16_t index,
|
| char guid[kAdmMaxGuidSize]) {
|
| const uint16_t nDevices(RecordingDevices());
|
|
|
| - if ((index > (nDevices - 1)) || (name == NULL)) {
|
| + if ((index > (nDevices - 1)) || (name == nullptr)) {
|
| return -1;
|
| }
|
|
|
| memset(name, 0, kAdmMaxDeviceNameSize);
|
|
|
| - if (guid != NULL) {
|
| + if (guid != nullptr) {
|
| memset(guid, 0, kAdmMaxGuidSize);
|
| }
|
|
|
| @@ -1106,7 +1106,7 @@ int32_t AudioDeviceMac::InitPlayout() {
|
| UInt32 dataSource = 0;
|
| size = sizeof(dataSource);
|
| WEBRTC_CA_LOG_WARN(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &dataSource));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &dataSource));
|
|
|
| if (dataSource == 'ispk') {
|
| _macBookProPanRight = true;
|
| @@ -1129,7 +1129,7 @@ int32_t AudioDeviceMac::InitPlayout() {
|
| memset(&_outStreamFormat, 0, sizeof(_outStreamFormat));
|
| size = sizeof(_outStreamFormat);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &_outStreamFormat));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &_outStreamFormat));
|
|
|
| if (_outStreamFormat.mFormatID != kAudioFormatLinearPCM) {
|
| logCAMsg(kTraceError, kTraceAudioDevice, _id,
|
| @@ -1246,7 +1246,7 @@ int32_t AudioDeviceMac::InitRecording() {
|
| memset(&_inStreamFormat, 0, sizeof(_inStreamFormat));
|
| size = sizeof(_inStreamFormat);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, &size, &_inStreamFormat));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, &size, &_inStreamFormat));
|
|
|
| if (_inStreamFormat.mFormatID != kAudioFormatLinearPCM) {
|
| logCAMsg(kTraceError, kTraceAudioDevice, _id,
|
| @@ -1342,7 +1342,7 @@ int32_t AudioDeviceMac::InitRecording() {
|
| AudioValueRange range;
|
| size = sizeof(range);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, &size, &range));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, &size, &range));
|
| if (range.mMinimum > bufByteCount) {
|
| bufByteCount = range.mMinimum;
|
| } else if (range.mMaximum < bufByteCount) {
|
| @@ -1352,14 +1352,14 @@ int32_t AudioDeviceMac::InitRecording() {
|
| propertyAddress.mSelector = kAudioDevicePropertyBufferSize;
|
| size = sizeof(bufByteCount);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectSetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, size, &bufByteCount));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, size, &bufByteCount));
|
|
|
| // Get capture device latency
|
| propertyAddress.mSelector = kAudioDevicePropertyLatency;
|
| UInt32 latency = 0;
|
| size = sizeof(UInt32);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, &size, &latency));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, &size, &latency));
|
| _captureLatencyUs = (UInt32)((1.0e6 * latency) / _inStreamFormat.mSampleRate);
|
|
|
| // Get capture stream latency
|
| @@ -1367,12 +1367,12 @@ int32_t AudioDeviceMac::InitRecording() {
|
| AudioStreamID stream = 0;
|
| size = sizeof(AudioStreamID);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, &size, &stream));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, &size, &stream));
|
| propertyAddress.mSelector = kAudioStreamPropertyLatency;
|
| size = sizeof(UInt32);
|
| latency = 0;
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _inputDeviceID, &propertyAddress, 0, NULL, &size, &latency));
|
| + _inputDeviceID, &propertyAddress, 0, nullptr, &size, &latency));
|
| _captureLatencyUs +=
|
| (UInt32)((1.0e6 * latency) / _inStreamFormat.mSampleRate);
|
|
|
| @@ -1734,7 +1734,7 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
| kAudioObjectPropertyElementMaster};
|
| UInt32 size = 0;
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyDataSize(
|
| - kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size));
|
| + kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &size));
|
| if (size == 0) {
|
| WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "No devices");
|
| return 0;
|
| @@ -1742,7 +1742,7 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
|
|
| AudioDeviceID* deviceIds = (AudioDeviceID*)malloc(size);
|
| UInt32 numberDevices = size / sizeof(AudioDeviceID);
|
| - AudioBufferList* bufferList = NULL;
|
| + AudioBufferList* bufferList = nullptr;
|
| UInt32 numberScopedDevices = 0;
|
|
|
| // First check if there is a default device and list it
|
| @@ -1759,9 +1759,9 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
|
|
| AudioDeviceID usedID;
|
| UInt32 uintSize = sizeof(UInt32);
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
| - &propertyAddressDefault, 0,
|
| - NULL, &uintSize, &usedID));
|
| + WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| + kAudioObjectSystemObject, &propertyAddressDefault, 0, nullptr, &uintSize,
|
| + &usedID));
|
| if (usedID != kAudioDeviceUnknown) {
|
| scopedDeviceIds[numberScopedDevices] = usedID;
|
| numberScopedDevices++;
|
| @@ -1773,8 +1773,9 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
| // Then list the rest of the devices
|
| bool listOK = true;
|
|
|
| - WEBRTC_CA_LOG_ERR(AudioObjectGetPropertyData(
|
| - kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, deviceIds));
|
| + WEBRTC_CA_LOG_ERR(AudioObjectGetPropertyData(kAudioObjectSystemObject,
|
| + &propertyAddress, 0, nullptr,
|
| + &size, deviceIds));
|
| if (err != noErr) {
|
| listOK = false;
|
| } else {
|
| @@ -1784,7 +1785,7 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
| for (UInt32 i = 0; i < numberDevices; i++) {
|
| // Check for input channels
|
| WEBRTC_CA_LOG_ERR(AudioObjectGetPropertyDataSize(
|
| - deviceIds[i], &propertyAddress, 0, NULL, &size));
|
| + deviceIds[i], &propertyAddress, 0, nullptr, &size));
|
| if (err == kAudioHardwareBadDeviceError) {
|
| // This device doesn't actually exist; continue iterating.
|
| continue;
|
| @@ -1795,7 +1796,7 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
|
|
| bufferList = (AudioBufferList*)malloc(size);
|
| WEBRTC_CA_LOG_ERR(AudioObjectGetPropertyData(
|
| - deviceIds[i], &propertyAddress, 0, NULL, &size, bufferList));
|
| + deviceIds[i], &propertyAddress, 0, nullptr, &size, bufferList));
|
| if (err != noErr) {
|
| listOK = false;
|
| break;
|
| @@ -1814,19 +1815,19 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
| }
|
|
|
| free(bufferList);
|
| - bufferList = NULL;
|
| + bufferList = nullptr;
|
| } // for
|
| }
|
|
|
| if (!listOK) {
|
| if (deviceIds) {
|
| free(deviceIds);
|
| - deviceIds = NULL;
|
| + deviceIds = nullptr;
|
| }
|
|
|
| if (bufferList) {
|
| free(bufferList);
|
| - bufferList = NULL;
|
| + bufferList = nullptr;
|
| }
|
|
|
| return -1;
|
| @@ -1835,7 +1836,7 @@ int32_t AudioDeviceMac::GetNumberDevices(const AudioObjectPropertyScope scope,
|
| // Happy ending
|
| if (deviceIds) {
|
| free(deviceIds);
|
| - deviceIds = NULL;
|
| + deviceIds = nullptr;
|
| }
|
|
|
| return numberScopedDevices;
|
| @@ -1873,8 +1874,9 @@ int32_t AudioDeviceMac::GetDeviceName(const AudioObjectPropertyScope scope,
|
| hardwareProperty, kAudioObjectPropertyScopeGlobal,
|
| kAudioObjectPropertyElementMaster};
|
| UInt32 size = sizeof(UInt32);
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, &usedID));
|
| + WEBRTC_CA_RETURN_ON_ERR(
|
| + AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress,
|
| + 0, nullptr, &size, &usedID));
|
| if (usedID == kAudioDeviceUnknown) {
|
| WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
| "GetDeviceName(): Default device unknown");
|
| @@ -1889,8 +1891,8 @@ int32_t AudioDeviceMac::GetDeviceName(const AudioObjectPropertyScope scope,
|
| if (isDefaultDevice) {
|
| char devName[len];
|
|
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(usedID, &propertyAddress,
|
| - 0, NULL, &len, devName));
|
| + WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| + usedID, &propertyAddress, 0, nullptr, &len, devName));
|
|
|
| sprintf(name, "default (%s)", devName);
|
| } else {
|
| @@ -1901,7 +1903,7 @@ int32_t AudioDeviceMac::GetDeviceName(const AudioObjectPropertyScope scope,
|
| }
|
|
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(usedID, &propertyAddress,
|
| - 0, NULL, &len, name));
|
| + 0, nullptr, &len, name));
|
| }
|
|
|
| return 0;
|
| @@ -1944,8 +1946,9 @@ int32_t AudioDeviceMac::InitDevice(const uint16_t userDeviceIndex,
|
| if (userDeviceIndex == 0) {
|
| // Try to use default system device
|
| size = sizeof(AudioDeviceID);
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, &deviceId));
|
| + WEBRTC_CA_RETURN_ON_ERR(
|
| + AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress,
|
| + 0, nullptr, &size, &deviceId));
|
| if (deviceId == kAudioDeviceUnknown) {
|
| WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
| " No default device exists");
|
| @@ -1969,13 +1972,13 @@ int32_t AudioDeviceMac::InitDevice(const uint16_t userDeviceIndex,
|
| propertyAddress.mScope = deviceScope;
|
| propertyAddress.mElement = 0;
|
| size = sizeof(devName);
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(deviceId, &propertyAddress,
|
| - 0, NULL, &size, devName));
|
| + WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| + deviceId, &propertyAddress, 0, nullptr, &size, devName));
|
|
|
| propertyAddress.mSelector = kAudioDevicePropertyDeviceManufacturer;
|
| size = sizeof(devManf);
|
| - WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(deviceId, &propertyAddress,
|
| - 0, NULL, &size, devManf));
|
| + WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| + deviceId, &propertyAddress, 0, nullptr, &size, devManf));
|
|
|
| if (isInput) {
|
| WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, " Input device: %s %s",
|
| @@ -2042,7 +2045,7 @@ OSStatus AudioDeviceMac::SetDesiredPlayoutFormat() {
|
| AudioValueRange range;
|
| UInt32 size = sizeof(range);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &range));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &range));
|
| if (range.mMinimum > bufByteCount) {
|
| bufByteCount = range.mMinimum;
|
| } else if (range.mMaximum < bufByteCount) {
|
| @@ -2052,14 +2055,14 @@ OSStatus AudioDeviceMac::SetDesiredPlayoutFormat() {
|
| propertyAddress.mSelector = kAudioDevicePropertyBufferSize;
|
| size = sizeof(bufByteCount);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectSetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, size, &bufByteCount));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, size, &bufByteCount));
|
|
|
| // Get render device latency.
|
| propertyAddress.mSelector = kAudioDevicePropertyLatency;
|
| UInt32 latency = 0;
|
| size = sizeof(UInt32);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &latency));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &latency));
|
| _renderLatencyUs =
|
| static_cast<uint32_t>((1.0e6 * latency) / _outStreamFormat.mSampleRate);
|
|
|
| @@ -2068,12 +2071,12 @@ OSStatus AudioDeviceMac::SetDesiredPlayoutFormat() {
|
| AudioStreamID stream = 0;
|
| size = sizeof(AudioStreamID);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &stream));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &stream));
|
| propertyAddress.mSelector = kAudioStreamPropertyLatency;
|
| size = sizeof(UInt32);
|
| latency = 0;
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - _outputDeviceID, &propertyAddress, 0, NULL, &size, &latency));
|
| + _outputDeviceID, &propertyAddress, 0, nullptr, &size, &latency));
|
| _renderLatencyUs +=
|
| static_cast<uint32_t>((1.0e6 * latency) / _outStreamFormat.mSampleRate);
|
|
|
| @@ -2090,7 +2093,7 @@ OSStatus AudioDeviceMac::objectListenerProc(
|
| const AudioObjectPropertyAddress addresses[],
|
| void* clientData) {
|
| AudioDeviceMac* ptrThis = (AudioDeviceMac*)clientData;
|
| - RTC_DCHECK(ptrThis != NULL);
|
| + RTC_DCHECK(ptrThis != nullptr);
|
|
|
| ptrThis->implObjectListenerProc(objectId, numberAddresses, addresses);
|
|
|
| @@ -2133,8 +2136,8 @@ int32_t AudioDeviceMac::HandleDeviceChange() {
|
| kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyScopeInput, 0};
|
| UInt32 deviceIsAlive = 1;
|
| UInt32 size = sizeof(UInt32);
|
| - err = AudioObjectGetPropertyData(_inputDeviceID, &propertyAddress, 0, NULL,
|
| - &size, &deviceIsAlive);
|
| + err = AudioObjectGetPropertyData(_inputDeviceID, &propertyAddress, 0,
|
| + nullptr, &size, &deviceIsAlive);
|
|
|
| if (err == kAudioHardwareBadDeviceError || deviceIsAlive == 0) {
|
| WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
| @@ -2158,8 +2161,8 @@ int32_t AudioDeviceMac::HandleDeviceChange() {
|
| kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyScopeOutput, 0};
|
| UInt32 deviceIsAlive = 1;
|
| UInt32 size = sizeof(UInt32);
|
| - err = AudioObjectGetPropertyData(_outputDeviceID, &propertyAddress, 0, NULL,
|
| - &size, &deviceIsAlive);
|
| + err = AudioObjectGetPropertyData(_outputDeviceID, &propertyAddress, 0,
|
| + nullptr, &size, &deviceIsAlive);
|
|
|
| if (err == kAudioHardwareBadDeviceError || deviceIsAlive == 0) {
|
| WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
| @@ -2196,7 +2199,7 @@ int32_t AudioDeviceMac::HandleStreamFormatChange(
|
| AudioStreamBasicDescription streamFormat;
|
| UInt32 size = sizeof(streamFormat);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - objectId, &propertyAddress, 0, NULL, &size, &streamFormat));
|
| + objectId, &propertyAddress, 0, nullptr, &size, &streamFormat));
|
|
|
| if (streamFormat.mFormatID != kAudioFormatLinearPCM) {
|
| logCAMsg(kTraceError, kTraceAudioDevice, _id,
|
| @@ -2289,7 +2292,7 @@ int32_t AudioDeviceMac::HandleDataSourceChange(
|
| UInt32 dataSource = 0;
|
| UInt32 size = sizeof(UInt32);
|
| WEBRTC_CA_RETURN_ON_ERR(AudioObjectGetPropertyData(
|
| - objectId, &propertyAddress, 0, NULL, &size, &dataSource));
|
| + objectId, &propertyAddress, 0, nullptr, &size, &dataSource));
|
| if (dataSource == 'ispk') {
|
| _macBookProPanRight = true;
|
| WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
| @@ -2337,7 +2340,7 @@ OSStatus AudioDeviceMac::deviceIOProc(AudioDeviceID,
|
| const AudioTimeStamp* outputTime,
|
| void* clientData) {
|
| AudioDeviceMac* ptrThis = (AudioDeviceMac*)clientData;
|
| - RTC_DCHECK(ptrThis != NULL);
|
| + RTC_DCHECK(ptrThis != nullptr);
|
|
|
| ptrThis->implDeviceIOProc(inputData, inputTime, outputData, outputTime);
|
|
|
| @@ -2351,7 +2354,7 @@ OSStatus AudioDeviceMac::outConverterProc(AudioConverterRef,
|
| AudioStreamPacketDescription**,
|
| void* userData) {
|
| AudioDeviceMac* ptrThis = (AudioDeviceMac*)userData;
|
| - RTC_DCHECK(ptrThis != NULL);
|
| + RTC_DCHECK(ptrThis != nullptr);
|
|
|
| return ptrThis->implOutConverterProc(numberDataPackets, data);
|
| }
|
| @@ -2364,7 +2367,7 @@ OSStatus AudioDeviceMac::inDeviceIOProc(AudioDeviceID,
|
| const AudioTimeStamp*,
|
| void* clientData) {
|
| AudioDeviceMac* ptrThis = (AudioDeviceMac*)clientData;
|
| - RTC_DCHECK(ptrThis != NULL);
|
| + RTC_DCHECK(ptrThis != nullptr);
|
|
|
| ptrThis->implInDeviceIOProc(inputData, inputTime);
|
|
|
| @@ -2379,7 +2382,7 @@ OSStatus AudioDeviceMac::inConverterProc(
|
| AudioStreamPacketDescription** /*dataPacketDescription*/,
|
| void* userData) {
|
| AudioDeviceMac* ptrThis = static_cast<AudioDeviceMac*>(userData);
|
| - RTC_DCHECK(ptrThis != NULL);
|
| + RTC_DCHECK(ptrThis != nullptr);
|
|
|
| return ptrThis->implInConverterProc(numberDataPackets, data);
|
| }
|
| @@ -2434,7 +2437,7 @@ OSStatus AudioDeviceMac::implDeviceIOProc(const AudioBufferList* inputData,
|
|
|
| // TODO(xians): signal an error somehow?
|
| err = AudioConverterFillComplexBuffer(_renderConverter, outConverterProc,
|
| - this, &size, outputData, NULL);
|
| + this, &size, outputData, nullptr);
|
| if (err != noErr) {
|
| if (err == 1) {
|
| // This is our own error.
|
| @@ -2681,7 +2684,7 @@ bool AudioDeviceMac::CaptureWorkerThread() {
|
| engineBuffer.mBuffers->mData = recordBuffer;
|
|
|
| err = AudioConverterFillComplexBuffer(_captureConverter, inConverterProc,
|
| - this, &size, &engineBuffer, NULL);
|
| + this, &size, &engineBuffer, nullptr);
|
| if (err != noErr) {
|
| if (err == 1) {
|
| // This is our own error.
|
|
|