From debda1aa5ee65d5ee43e32a1b981ece993e7f5c3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Tue, 21 Jan 2020 06:25:18 +0400 Subject: [PATCH] Fix spaces on end of lines --- Buffers.h | 2 +- EchoCanceller.cpp | 2 +- JitterBuffer.cpp | 2 +- Makefile.in | 24 +++---- NetworkSocket.h | 2 +- VoIPController.h | 14 ++-- audio/AudioIO.h | 8 +-- audio/AudioIOCallback.h | 4 +- audio/AudioInput.cpp | 2 +- audio/AudioInput.h | 2 +- audio/AudioOutput.cpp | 2 +- audio/AudioOutput.h | 2 +- libtgvoip.gyp | 2 +- os/android/VideoRendererAndroid.cpp | 2 +- os/darwin/AudioInputAudioUnit.cpp | 2 +- os/darwin/AudioInputAudioUnitOSX.cpp | 56 +++++++-------- os/darwin/AudioOutputAudioUnitOSX.cpp | 70 +++++++++---------- os/darwin/AudioOutputAudioUnitOSX.h | 2 +- os/darwin/AudioUnitIO.cpp | 36 +++++----- os/darwin/AudioUnitIO.h | 2 +- os/darwin/DarwinSpecific.h | 4 +- os/darwin/SampleBufferDisplayLayerRenderer.mm | 2 +- os/darwin/TGLogWrapper.h | 2 +- os/darwin/VideoToolboxEncoderSource.mm | 10 +-- os/linux/AudioPulse.cpp | 4 +- os/posix/NetworkSocketPosix.cpp | 2 +- os/windows/AudioInputWASAPI.cpp | 6 +- os/windows/AudioInputWave.cpp | 4 +- os/windows/AudioOutputWASAPI.cpp | 6 +- os/windows/AudioOutputWave.cpp | 2 +- os/windows/CXWrapper.cpp | 8 +-- tests/MockReflector.cpp | 8 +-- tests/MockReflector.h | 2 +- tests/libtgvoipTests.mm | 58 +++++++-------- threading.h | 14 ++-- video/ScreamCongestionController.cpp | 2 +- .../signal_processing/resample_by_2.c | 2 +- .../isac/main/source/bandwidth_estimator.c | 2 +- 38 files changed, 188 insertions(+), 188 deletions(-) diff --git a/Buffers.h b/Buffers.h index d1ec35a7..87a87b65 100644 --- a/Buffers.h +++ b/Buffers.h @@ -66,7 +66,7 @@ namespace tgvoip{ size_t GetLength(); void Reset(); void Rewind(size_t numBytes); - + BufferOutputStream& operator=(BufferOutputStream&& other){ if(this!=&other){ if(!bufferProvided && buffer) diff --git a/EchoCanceller.cpp b/EchoCanceller.cpp index bd8b31b2..f6aa51e6 100755 --- a/EchoCanceller.cpp +++ b/EchoCanceller.cpp @@ -44,7 +44,7 @@ EchoCanceller::EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC){ config.high_pass_filter.enabled = enableAEC; config.gain_controller2.enabled = enableAGC; apm->ApplyConfig(config); - + webrtc::NoiseSuppression::Level nsLevel; #ifdef __APPLE__ switch(ServerConfig::GetSharedInstance()->GetInt("webrtc_ns_level_vpio", 0)){ diff --git a/JitterBuffer.cpp b/JitterBuffer.cpp index 18bf2ad8..0b051258 100755 --- a/JitterBuffer.cpp +++ b/JitterBuffer.cpp @@ -246,7 +246,7 @@ void JitterBuffer::PutInternal(jitter_packet_t* pkt, bool overwriteExisting){ first=true; LOGI("jitter: resyncing, next timestamp = %lld (step=%d, minDelay=%f)", (long long int)nextTimestamp, step, minDelay); } - + for(i=0;i class ContextlessAudioIO : public AudioIO{ public: ContextlessAudioIO(){ @@ -42,16 +42,16 @@ namespace tgvoip{ input=new I(inputDeviceID); output=new O(outputDeviceID); } - + virtual ~ContextlessAudioIO(){ delete input; delete output; } - + virtual AudioInput* GetInput(){ return input; } - + virtual AudioOutput* GetOutput(){ return output; } diff --git a/audio/AudioIOCallback.h b/audio/AudioIOCallback.h index 4240970f..706fd4b8 100644 --- a/audio/AudioIOCallback.h +++ b/audio/AudioIOCallback.h @@ -28,7 +28,7 @@ namespace tgvoip{ Thread* thread; std::function dataCallback; }; - + class AudioOutputCallback : public AudioOutput{ public: AudioOutputCallback(); @@ -44,7 +44,7 @@ namespace tgvoip{ Thread* thread; std::function dataCallback; }; - + class AudioIOCallback : public AudioIO{ public: AudioIOCallback(); diff --git a/audio/AudioInput.cpp b/audio/AudioInput.cpp index dae647a1..4d5b5732 100644 --- a/audio/AudioInput.cpp +++ b/audio/AudioInput.cpp @@ -89,7 +89,7 @@ std::string AudioInput::GetCurrentDevice(){ } void AudioInput::SetCurrentDevice(std::string deviceID){ - + } int32_t AudioInput::GetEstimatedDelay(){ diff --git a/audio/AudioInput.h b/audio/AudioInput.h index 3fa528dc..ea8c04b2 100644 --- a/audio/AudioInput.h +++ b/audio/AudioInput.h @@ -16,7 +16,7 @@ namespace tgvoip{ class AudioInputDevice; class AudioOutputDevice; - + namespace audio{ class AudioInput : public MediaStreamItf{ public: diff --git a/audio/AudioOutput.cpp b/audio/AudioOutput.cpp index 458e8a5c..dc7b61ab 100644 --- a/audio/AudioOutput.cpp +++ b/audio/AudioOutput.cpp @@ -101,7 +101,7 @@ std::string AudioOutput::GetCurrentDevice(){ } void AudioOutput::SetCurrentDevice(std::string deviceID){ - + } bool AudioOutput::IsInitialized(){ diff --git a/audio/AudioOutput.h b/audio/AudioOutput.h index 6f66a906..cff28fe2 100644 --- a/audio/AudioOutput.h +++ b/audio/AudioOutput.h @@ -17,7 +17,7 @@ namespace tgvoip{ class AudioInputDevice; class AudioOutputDevice; - + namespace audio{ class AudioOutput : public MediaStreamItf{ public: diff --git a/libtgvoip.gyp b/libtgvoip.gyp index d5a5adb0..d0b48611 100644 --- a/libtgvoip.gyp +++ b/libtgvoip.gyp @@ -700,7 +700,7 @@ '<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_core.c', '<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_sp.h', '<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_filterbank.h', - '<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_gmm.c', + '<(tgvoip_src_loc)/webrtc_dsp/common_audio/vad/vad_gmm.c', # ARM/NEON sources # TODO check if there's a good way to make these compile with ARM ports of TDesktop diff --git a/os/android/VideoRendererAndroid.cpp b/os/android/VideoRendererAndroid.cpp index 2d097db6..c597017d 100644 --- a/os/android/VideoRendererAndroid.cpp +++ b/os/android/VideoRendererAndroid.cpp @@ -54,7 +54,7 @@ void VideoRendererAndroid::Reset(uint32_t codec, unsigned int width, unsigned in Request::Type::UpdateStreamState }; queue.Put(std::move(req2)); - + if(!thread){ thread=new Thread(std::bind(&VideoRendererAndroid::RunThread, this)); thread->Start(); diff --git a/os/darwin/AudioInputAudioUnit.cpp b/os/darwin/AudioInputAudioUnit.cpp index 3f804267..8cc28ce8 100644 --- a/os/darwin/AudioInputAudioUnit.cpp +++ b/os/darwin/AudioInputAudioUnit.cpp @@ -26,7 +26,7 @@ AudioInputAudioUnit::AudioInputAudioUnit(std::string deviceID, AudioUnitIO* io){ } AudioInputAudioUnit::~AudioInputAudioUnit(){ - + } void AudioInputAudioUnit::Start(){ diff --git a/os/darwin/AudioInputAudioUnitOSX.cpp b/os/darwin/AudioInputAudioUnitOSX.cpp index e9218b18..7f018d8a 100644 --- a/os/darwin/AudioInputAudioUnitOSX.cpp +++ b/os/darwin/AudioInputAudioUnitOSX.cpp @@ -27,7 +27,7 @@ AudioInputAudioUnitLegacy::AudioInputAudioUnitLegacy(std::string deviceID) : Aud inBufferList.mBuffers[0].mData=malloc(10240); inBufferList.mBuffers[0].mDataByteSize=10240; inBufferList.mNumberBuffers=1; - + OSStatus status; AudioComponentDescription inputDesc={ .componentType = kAudioUnitType_Output, .componentSubType = kAudioUnitSubType_HALOutput, .componentFlags = 0, .componentFlagsMask = 0, @@ -36,27 +36,27 @@ AudioInputAudioUnitLegacy::AudioInputAudioUnitLegacy(std::string deviceID) : Aud AudioComponent component=AudioComponentFindNext(NULL, &inputDesc); status=AudioComponentInstanceNew(component, &unit); CHECK_AU_ERROR(status, "Error creating AudioUnit"); - + UInt32 flag=0; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, kOutputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit output"); flag=1; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit input"); - + SetCurrentDevice(deviceID); - + CFRunLoopRef theRunLoop = NULL; AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; status = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop); - + propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioInputAudioUnitLegacy::DefaultDeviceChangedCallback, this); - + AURenderCallbackStruct callbackStruct; callbackStruct.inputProc = AudioInputAudioUnitLegacy::BufferCallback; callbackStruct.inputProcRefCon=this; @@ -72,7 +72,7 @@ AudioInputAudioUnitLegacy::~AudioInputAudioUnitLegacy(){ propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioInputAudioUnitLegacy::DefaultDeviceChangedCallback, this); - + AudioUnitUninitialize(unit); AudioComponentInstanceDispose(unit); free(inBufferList.mBuffers[0].mData); @@ -127,19 +127,19 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; - + UInt32 dataSize = 0; OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyDataSize (kAudioHardwarePropertyDevices) failed: %i", status); return; } - + UInt32 deviceCount = (UInt32)(dataSize / sizeof(AudioDeviceID)); - + AudioDeviceID *audioDevices = (AudioDeviceID*)(malloc(dataSize)); - + status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyData (kAudioHardwarePropertyDevices) failed: %i", status); @@ -147,8 +147,8 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& audioDevices = NULL; return; } - - + + // Iterate through all the devices and determine which are input-capable propertyAddress.mScope = kAudioDevicePropertyScopeInput; for(UInt32 i = 0; i < deviceCount; ++i) { @@ -161,7 +161,7 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID) failed: %i", status); continue; } - + // Query device name CFStringRef deviceName = NULL; dataSize = sizeof(deviceName); @@ -171,7 +171,7 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceNameCFString) failed: %i", status); continue; } - + // Determine if the device is an input device (it is an input device if it has input channels) dataSize = 0; propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; @@ -180,9 +180,9 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& LOGE("AudioObjectGetPropertyDataSize (kAudioDevicePropertyStreamConfiguration) failed: %i", status); continue; } - + AudioBufferList *bufferList = (AudioBufferList*)(malloc(dataSize)); - + status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, bufferList); if(kAudioHardwareNoError != status || 0 == bufferList->mNumberBuffers) { if(kAudioHardwareNoError != status) @@ -191,10 +191,10 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& bufferList = NULL; continue; } - + free(bufferList); bufferList = NULL; - + AudioInputDevice dev; char buf[1024]; CFStringGetCString(deviceName, buf, 1024, kCFStringEncodingUTF8); @@ -205,7 +205,7 @@ void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector& continue; devs.push_back(dev); } - + free(audioDevices); audioDevices = NULL; } @@ -214,7 +214,7 @@ void AudioInputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ UInt32 size=sizeof(AudioDeviceID); AudioDeviceID inputDevice=0; OSStatus status; - + if(deviceID=="default"){ AudioObjectPropertyAddress propertyAddress; propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; @@ -257,7 +257,7 @@ void AudioInputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ return; } } - + status =AudioUnitSetProperty(unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, @@ -265,25 +265,25 @@ void AudioInputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ &inputDevice, size); CHECK_AU_ERROR(status, "Error setting input device"); - + AudioStreamBasicDescription hardwareFormat; size=sizeof(hardwareFormat); status=AudioUnitGetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kInputBus, &hardwareFormat, &size); CHECK_AU_ERROR(status, "Error getting hardware format"); hardwareSampleRate=hardwareFormat.mSampleRate; - + AudioStreamBasicDescription desiredFormat={ .mSampleRate=hardwareFormat.mSampleRate, .mFormatID=kAudioFormatLinearPCM, .mFormatFlags=kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian, .mFramesPerPacket=1, .mChannelsPerFrame=1, .mBitsPerChannel=16, .mBytesPerPacket=2, .mBytesPerFrame=2 }; - + status=AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &desiredFormat, sizeof(desiredFormat)); CHECK_AU_ERROR(status, "Error setting format"); - + LOGD("Switched capture device, new sample rate %d", hardwareSampleRate); - + this->currentDevice=deviceID; - + AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyBufferFrameSize, kAudioObjectPropertyScopeGlobal, diff --git a/os/darwin/AudioOutputAudioUnitOSX.cpp b/os/darwin/AudioOutputAudioUnitOSX.cpp index cc023f8e..d2c4de82 100644 --- a/os/darwin/AudioOutputAudioUnitOSX.cpp +++ b/os/darwin/AudioOutputAudioUnitOSX.cpp @@ -24,7 +24,7 @@ AudioOutputAudioUnitLegacy::AudioOutputAudioUnitLegacy(std::string deviceID){ remainingDataSize=0; isPlaying=false; sysDevID=0; - + OSStatus status; AudioComponentDescription inputDesc={ .componentType = kAudioUnitType_Output, .componentSubType = kAudioUnitSubType_HALOutput, .componentFlags = 0, .componentFlagsMask = 0, @@ -33,14 +33,14 @@ AudioOutputAudioUnitLegacy::AudioOutputAudioUnitLegacy(std::string deviceID){ AudioComponent component=AudioComponentFindNext(NULL, &inputDesc); status=AudioComponentInstanceNew(component, &unit); CHECK_AU_ERROR(status, "Error creating AudioUnit"); - + UInt32 flag=1; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, kOutputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit output"); flag=0; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit input"); - + char model[128]; memset(model, 0, sizeof(model)); size_t msize=sizeof(model); @@ -49,28 +49,28 @@ AudioOutputAudioUnitLegacy::AudioOutputAudioUnitLegacy(std::string deviceID){ LOGV("Mac model: %s", model); isMacBookPro=(strncmp("MacBookPro", model, 10)==0); } - + SetCurrentDevice(deviceID); - + CFRunLoopRef theRunLoop = NULL; AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; status = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop); - + propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioOutputAudioUnitLegacy::DefaultDeviceChangedCallback, this); - + AudioStreamBasicDescription desiredFormat={ .mSampleRate=/*hardwareFormat.mSampleRate*/48000, .mFormatID=kAudioFormatLinearPCM, .mFormatFlags=kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian, .mFramesPerPacket=1, .mChannelsPerFrame=1, .mBitsPerChannel=16, .mBytesPerPacket=2, .mBytesPerFrame=2 }; - + status=AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &desiredFormat, sizeof(desiredFormat)); CHECK_AU_ERROR(status, "Error setting format"); - + AURenderCallbackStruct callbackStruct; callbackStruct.inputProc = AudioOutputAudioUnitLegacy::BufferCallback; callbackStruct.inputProcRefCon=this; @@ -86,7 +86,7 @@ AudioOutputAudioUnitLegacy::~AudioOutputAudioUnitLegacy(){ propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioOutputAudioUnitLegacy::DefaultDeviceChangedCallback, this); - + AudioObjectPropertyAddress dataSourceProp={ kAudioDevicePropertyDataSource, kAudioDevicePropertyScopeOutput, @@ -95,7 +95,7 @@ AudioOutputAudioUnitLegacy::~AudioOutputAudioUnitLegacy(){ if(isMacBookPro && sysDevID && AudioObjectHasProperty(sysDevID, &dataSourceProp)){ AudioObjectRemovePropertyListener(sysDevID, &dataSourceProp, AudioOutputAudioUnitLegacy::DefaultDeviceChangedCallback, this); } - + AudioUnitUninitialize(unit); AudioComponentInstanceDispose(unit); } @@ -148,19 +148,19 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; - + UInt32 dataSize = 0; OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyDataSize (kAudioHardwarePropertyDevices) failed: %i", status); return; } - + UInt32 deviceCount = (UInt32)(dataSize / sizeof(AudioDeviceID)); - - + + AudioDeviceID *audioDevices = (AudioDeviceID*)(malloc(dataSize)); - + status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyData (kAudioHardwarePropertyDevices) failed: %i", status); @@ -168,8 +168,8 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector audioDevices = NULL; return; } - - + + // Iterate through all the devices and determine which are input-capable propertyAddress.mScope = kAudioDevicePropertyScopeOutput; for(UInt32 i = 0; i < deviceCount; ++i) { @@ -182,7 +182,7 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID) failed: %i", status); continue; } - + // Query device name CFStringRef deviceName = NULL; dataSize = sizeof(deviceName); @@ -192,7 +192,7 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceNameCFString) failed: %i", status); continue; } - + // Determine if the device is an input device (it is an input device if it has input channels) dataSize = 0; propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; @@ -201,9 +201,9 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector LOGE("AudioObjectGetPropertyDataSize (kAudioDevicePropertyStreamConfiguration) failed: %i", status); continue; } - + AudioBufferList *bufferList = (AudioBufferList*)(malloc(dataSize)); - + status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, bufferList); if(kAudioHardwareNoError != status || 0 == bufferList->mNumberBuffers) { if(kAudioHardwareNoError != status) @@ -212,10 +212,10 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector bufferList = NULL; continue; } - + free(bufferList); bufferList = NULL; - + AudioOutputDevice dev; char buf[1024]; CFStringGetCString(deviceName, buf, 1024, kCFStringEncodingUTF8); @@ -226,7 +226,7 @@ void AudioOutputAudioUnitLegacy::EnumerateDevices(std::vector continue; devs.push_back(dev); } - + free(audioDevices); audioDevices = NULL; } @@ -240,11 +240,11 @@ void AudioOutputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ kAudioDevicePropertyScopeOutput, kAudioObjectPropertyElementMaster }; - + if(isMacBookPro && sysDevID && AudioObjectHasProperty(sysDevID, &dataSourceProp)){ AudioObjectRemovePropertyListener(sysDevID, &dataSourceProp, AudioOutputAudioUnitLegacy::DefaultDeviceChangedCallback, this); } - + if(deviceID=="default"){ AudioObjectPropertyAddress propertyAddress; propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; @@ -287,7 +287,7 @@ void AudioOutputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ return; } } - + status =AudioUnitSetProperty(unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, @@ -295,26 +295,26 @@ void AudioOutputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ &outputDevice, size); CHECK_AU_ERROR(status, "Error setting output device"); - + AudioStreamBasicDescription hardwareFormat; size=sizeof(hardwareFormat); status=AudioUnitGetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kOutputBus, &hardwareFormat, &size); CHECK_AU_ERROR(status, "Error getting hardware format"); hardwareSampleRate=hardwareFormat.mSampleRate; - + AudioStreamBasicDescription desiredFormat={ .mSampleRate=48000, .mFormatID=kAudioFormatLinearPCM, .mFormatFlags=kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian, .mFramesPerPacket=1, .mChannelsPerFrame=1, .mBitsPerChannel=16, .mBytesPerPacket=2, .mBytesPerFrame=2 }; - + status=AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &desiredFormat, sizeof(desiredFormat)); CHECK_AU_ERROR(status, "Error setting format"); - + LOGD("Switched playback device, new sample rate %d", hardwareSampleRate); - + this->currentDevice=deviceID; sysDevID=outputDevice; - + AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyBufferFrameSize, kAudioObjectPropertyScopeGlobal, @@ -327,7 +327,7 @@ void AudioOutputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ estimatedDelay=bufferFrameSize/48; LOGD("CoreAudio buffer size for output device is %u frames (%u ms)", bufferFrameSize, estimatedDelay); } - + if(isMacBookPro){ if(AudioObjectHasProperty(outputDevice, &dataSourceProp)){ UInt32 dataSource; diff --git a/os/darwin/AudioOutputAudioUnitOSX.h b/os/darwin/AudioOutputAudioUnitOSX.h index 0405b2f1..c4f2b951 100644 --- a/os/darwin/AudioOutputAudioUnitOSX.h +++ b/os/darwin/AudioOutputAudioUnitOSX.h @@ -24,7 +24,7 @@ class AudioOutputAudioUnitLegacy : public AudioOutput{ void HandleBufferCallback(AudioBufferList* ioData); static void EnumerateDevices(std::vector& devs); virtual void SetCurrentDevice(std::string deviceID); - + private: static OSStatus BufferCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); static OSStatus DefaultDeviceChangedCallback(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData); diff --git a/os/darwin/AudioUnitIO.cpp b/os/darwin/AudioUnitIO.cpp index 86b3fa43..1316b75d 100644 --- a/os/darwin/AudioUnitIO.cpp +++ b/os/darwin/AudioUnitIO.cpp @@ -45,11 +45,11 @@ AudioUnitIO::AudioUnitIO(std::string inputDeviceID, std::string outputDeviceID){ inBufferList.mBuffers[0].mData=malloc(INPUT_BUFFER_SIZE); inBufferList.mBuffers[0].mDataByteSize=INPUT_BUFFER_SIZE; inBufferList.mNumberBuffers=1; - + #if TARGET_OS_IPHONE DarwinSpecific::ConfigureAudioSession(); #endif - + OSStatus status; AudioComponentDescription desc; AudioComponent inputComponent; @@ -60,7 +60,7 @@ AudioUnitIO::AudioUnitIO(std::string inputDeviceID, std::string outputDeviceID){ desc.componentManufacturer = kAudioUnitManufacturer_Apple; inputComponent = AudioComponentFindNext(NULL, &desc); status = AudioComponentInstanceNew(inputComponent, &unit); - + UInt32 flag=1; #if TARGET_OS_IPHONE status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, kOutputBus, &flag, sizeof(flag)); @@ -68,7 +68,7 @@ AudioUnitIO::AudioUnitIO(std::string inputDeviceID, std::string outputDeviceID){ status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit input"); #endif - + #if TARGET_OS_IPHONE flag=ServerConfig::GetSharedInstance()->GetBoolean("use_ios_vpio_agc", true) ? 1 : 0; #else @@ -76,7 +76,7 @@ AudioUnitIO::AudioUnitIO(std::string inputDeviceID, std::string outputDeviceID){ #endif status=AudioUnitSetProperty(unit, kAUVoiceIOProperty_VoiceProcessingEnableAGC, kAudioUnitScope_Global, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error disabling AGC"); - + AudioStreamBasicDescription audioFormat; audioFormat.mSampleRate = 48000; audioFormat.mFormatID = kAudioFormatLinearPCM; @@ -93,39 +93,39 @@ AudioUnitIO::AudioUnitIO(std::string inputDeviceID, std::string outputDeviceID){ #endif audioFormat.mFramesPerPacket = 1; audioFormat.mChannelsPerFrame = 1; - + status = AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &audioFormat, sizeof(audioFormat)); CHECK_AU_ERROR(status, "Error setting output format"); status = AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &audioFormat, sizeof(audioFormat)); CHECK_AU_ERROR(status, "Error setting input format"); - + AURenderCallbackStruct callbackStruct; - + callbackStruct.inputProc = AudioUnitIO::BufferCallback; callbackStruct.inputProcRefCon = this; status = AudioUnitSetProperty(unit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Global, kOutputBus, &callbackStruct, sizeof(callbackStruct)); CHECK_AU_ERROR(status, "Error setting output buffer callback"); status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callbackStruct, sizeof(callbackStruct)); CHECK_AU_ERROR(status, "Error setting input buffer callback"); - + #if TARGET_OS_OSX CFRunLoopRef theRunLoop = NULL; AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; status = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop); - + propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioUnitIO::DefaultDeviceChangedCallback, this); propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioUnitIO::DefaultDeviceChangedCallback, this); - - + + #endif - - + + input=new AudioInputAudioUnit(inputDeviceID, this); output=new AudioOutputAudioUnit(outputDeviceID, this); } @@ -229,7 +229,7 @@ void AudioUnitIO::SetCurrentDevice(bool input, std::string deviceID){ UInt32 size=sizeof(AudioDeviceID); AudioDeviceID device=0; OSStatus status; - + if(deviceID=="default"){ AudioObjectPropertyAddress propertyAddress; propertyAddress.mSelector = input ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice; @@ -272,7 +272,7 @@ void AudioUnitIO::SetCurrentDevice(bool input, std::string deviceID){ return; } } - + status=AudioUnitSetProperty(unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, @@ -280,12 +280,12 @@ void AudioUnitIO::SetCurrentDevice(bool input, std::string deviceID){ &device, size); CHECK_AU_ERROR(status, "Error setting input device"); - + if(input) currentInputDevice=deviceID; else currentOutputDevice=deviceID; - + /*AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyBufferFrameSize, kAudioObjectPropertyScopeGlobal, diff --git a/os/darwin/AudioUnitIO.h b/os/darwin/AudioUnitIO.h index 14351d8e..802d4a63 100644 --- a/os/darwin/AudioUnitIO.h +++ b/os/darwin/AudioUnitIO.h @@ -29,7 +29,7 @@ class AudioOutputAudioUnit; void SetCurrentDevice(bool input, std::string deviceID); void SetDuckingEnabled(bool enabled); #endif - + private: static OSStatus BufferCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData); void BufferCallback(AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 bus, UInt32 numFrames, AudioBufferList* ioData); diff --git a/os/darwin/DarwinSpecific.h b/os/darwin/DarwinSpecific.h index 87cd878e..a59ce4d7 100644 --- a/os/darwin/DarwinSpecific.h +++ b/os/darwin/DarwinSpecific.h @@ -10,9 +10,9 @@ #include namespace tgvoip { - + struct CellularCarrierInfo; - + class DarwinSpecific{ public: enum{ diff --git a/os/darwin/SampleBufferDisplayLayerRenderer.mm b/os/darwin/SampleBufferDisplayLayerRenderer.mm index 2df98ba1..6b5119d9 100644 --- a/os/darwin/SampleBufferDisplayLayerRenderer.mm +++ b/os/darwin/SampleBufferDisplayLayerRenderer.mm @@ -105,7 +105,7 @@ CFArrayRef attachments=CMSampleBufferGetSampleAttachmentsArray(sampleBuffer, true); CFMutableDictionaryRef dict=(CFMutableDictionaryRef)CFArrayGetValueAtIndex(attachments, 0); CFDictionarySetValue(dict, kCMSampleAttachmentKey_DisplayImmediately, kCFBooleanTrue); - + [renderer _enqueueBuffer:sampleBuffer reset:needReset]; needReset=false; CFRelease(sampleBuffer); diff --git a/os/darwin/TGLogWrapper.h b/os/darwin/TGLogWrapper.h index 8f111774..289577e0 100644 --- a/os/darwin/TGLogWrapper.h +++ b/os/darwin/TGLogWrapper.h @@ -12,7 +12,7 @@ extern "C" { #endif void __tgvoip_call_tglog(const char* format, ...); - + #if defined __cplusplus }; #endif diff --git a/os/darwin/VideoToolboxEncoderSource.mm b/os/darwin/VideoToolboxEncoderSource.mm index dc996c6f..3c573127 100644 --- a/os/darwin/VideoToolboxEncoderSource.mm +++ b/os/darwin/VideoToolboxEncoderSource.mm @@ -94,7 +94,7 @@ status=VTSessionSetProperty(session, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue); CHECK_ERR(status, "VTSessionSetProperty(RealTime)"); LOGD("VTCompressionSession initialized"); - + // TODO change camera frame rate dynamically based on resolution + codec } @@ -125,7 +125,7 @@ frameProps=CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL); keyframeRequested=false; } - + //CMVideoDimensions size=CMVideoFormatDescriptionGetDimensions(format); //LOGD("EncodeFrame %d x %d", size.width, size.height); CVImageBufferRef imgBuffer=CMSampleBufferGetImageBuffer(frame); @@ -202,7 +202,7 @@ }else{ frameFlags |= VIDEO_FRAME_FLAG_KEYFRAME; } - + Buffer frame(len); CMBlockBufferCopyDataBytes(blockBuffer, 0, len, *frame); uint32_t offset=0; @@ -213,14 +213,14 @@ offset+=nalLen+4; } callback(std::move(frame), frameFlags); - + //LOGV("EncoderCallback: %u bytes total", (unsigned int)len); } void VideoToolboxEncoderSource::SetEncoderBitrateAndLimit(uint32_t bitrate){ OSStatus status=VTSessionSetProperty(session, kVTCompressionPropertyKey_AverageBitRate, (__bridge CFTypeRef)@(bitrate)); CHECK_ERR(status, "VTSessionSetProperty(AverageBitRate)"); - + int64_t dataLimitValue=(int64_t)(bitrate/8); CFNumberRef bytesPerSecond=CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &dataLimitValue); int64_t oneValue=1; diff --git a/os/linux/AudioPulse.cpp b/os/linux/AudioPulse.cpp index f02ece86..06cc98b5 100644 --- a/os/linux/AudioPulse.cpp +++ b/os/linux/AudioPulse.cpp @@ -131,7 +131,7 @@ AudioPulse::AudioPulse(std::string inputDevice, std::string outputDevice){ LOGE("Failed to load libpulse"); return; } - + mainloop=pa_threaded_mainloop_new(); if(!mainloop){ LOGE("Error initializing PulseAudio (pa_threaded_mainloop_new)"); @@ -202,7 +202,7 @@ AudioPulse::~AudioPulse(){ pa_threaded_mainloop_unlock(mainloop); pa_threaded_mainloop_stop(mainloop); } - + if(input) delete input; if(output) diff --git a/os/posix/NetworkSocketPosix.cpp b/os/posix/NetworkSocketPosix.cpp index 52eef76d..78e05836 100644 --- a/os/posix/NetworkSocketPosix.cpp +++ b/os/posix/NetworkSocketPosix.cpp @@ -295,7 +295,7 @@ void NetworkSocketPosix::Open(){ void NetworkSocketPosix::Close(){ closing=true; failed=true; - + if (fd>=0) { shutdown(fd, SHUT_RDWR); close(fd); diff --git a/os/windows/AudioInputWASAPI.cpp b/os/windows/AudioInputWASAPI.cpp index 97179c24..1fcb92fe 100755 --- a/os/windows/AudioInputWASAPI.cpp +++ b/os/windows/AudioInputWASAPI.cpp @@ -106,7 +106,7 @@ void AudioInputWASAPI::Start(){ if(!thread){ thread=CreateThread(NULL, 0, AudioInputWASAPI::StartThread, this, 0, NULL); } - + if(audioClient && !started){ LOGI("audioClient->Start"); audioClient->Start(); @@ -155,7 +155,7 @@ void AudioInputWASAPI::EnumerateDevices(std::vector& d res=device->OpenPropertyStore(STGM_READ, &propStore); SafeRelease(&device); SCHECK_RES(res, "OpenPropertyStore"); - + PROPVARIANT friendlyName; PropVariantInit(&friendlyName); res=propStore->GetValue(PKEY_Device_FriendlyName, &friendlyName); @@ -260,7 +260,7 @@ void AudioInputWASAPI::ActuallySetCurrentDevice(std::string deviceID){ failed=true; return; } - + res=device->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, (void**)&audioClient); CHECK_RES(res, "device->Activate"); #else diff --git a/os/windows/AudioInputWave.cpp b/os/windows/AudioInputWave.cpp index aaf12bf3..233d9518 100755 --- a/os/windows/AudioInputWave.cpp +++ b/os/windows/AudioInputWave.cpp @@ -40,7 +40,7 @@ AudioInputWave::~AudioInputWave(){ void AudioInputWave::Start(){ if(!isRecording){ isRecording=true; - + MMRESULT res; for(int i=0;i<4;i++){ res=waveInPrepareHeader(hWaveIn, &buffers[i], sizeof(WAVEHDR)); @@ -56,7 +56,7 @@ void AudioInputWave::Start(){ void AudioInputWave::Stop(){ if(isRecording){ isRecording=false; - + MMRESULT res=waveInStop(hWaveIn); CHECK_ERROR(res, "waveInStop failed"); res=waveInReset(hWaveIn); diff --git a/os/windows/AudioOutputWASAPI.cpp b/os/windows/AudioOutputWASAPI.cpp index 65d99c3e..e667fcc8 100755 --- a/os/windows/AudioOutputWASAPI.cpp +++ b/os/windows/AudioOutputWASAPI.cpp @@ -151,7 +151,7 @@ void AudioOutputWASAPI::EnumerateDevices(std::vector& res=device->OpenPropertyStore(STGM_READ, &propStore); SafeRelease(&device); SCHECK_RES(res, "OpenPropertyStore"); - + PROPVARIANT friendlyName; PropVariantInit(&friendlyName); res=propStore->GetValue(PKEY_Device_FriendlyName, &friendlyName); @@ -256,7 +256,7 @@ void AudioOutputWASAPI::ActuallySetCurrentDevice(std::string deviceID){ failed=true; return; } - + res=device->Activate(__uuidof(IAudioClient), CLSCTX_INPROC_SERVER, NULL, (void**)&audioClient); CHECK_RES(res, "device->Activate"); #else @@ -383,7 +383,7 @@ void AudioOutputWASAPI::RunThread() { //double t=VoIPController::GetCurrentTime(); //LOGV("framesAvail: %u, time: %f, isPlaying: %d", framesAvailable, t-prevCallback, isPlaying); //prevCallback=t; - + size_t bytesAvailable=framesAvailable*2; while(bytesAvailable>remainingDataLen){ if(isPlaying){ diff --git a/os/windows/AudioOutputWave.cpp b/os/windows/AudioOutputWave.cpp index 604f4031..9d0a631b 100755 --- a/os/windows/AudioOutputWave.cpp +++ b/os/windows/AudioOutputWave.cpp @@ -38,7 +38,7 @@ AudioOutputWave::~AudioOutputWave(){ void AudioOutputWave::Start(){ if(!isPlaying){ isPlaying=true; - + for(int i=0;i<4;i++){ MMRESULT res=waveOutPrepareHeader(hWaveOut, &buffers[i], sizeof(WAVEHDR)); CHECK_ERROR(res, "waveOutPrepareHeader failed"); diff --git a/os/windows/CXWrapper.cpp b/os/windows/CXWrapper.cpp index 4af2d079..00a9400e 100755 --- a/os/windows/CXWrapper.cpp +++ b/os/windows/CXWrapper.cpp @@ -5,8 +5,8 @@ #include #include #include "CXWrapper.h" -#include -#include +#include +#include using namespace Windows::Storage::Streams; using namespace Microsoft::WRL; @@ -437,8 +437,8 @@ IBuffer^ MicrosoftCryptoImpl::IBufferFromPtr(uint8_t* msg, size_t len) Platform::Array^ out=ref new Platform::Array(32); Platform::Array^ key=ref new Platform::Array(16); Platform::Array^ iv=ref new Platform::Array(32); - - + + CryptographicBuffer::CopyToByteArray(CryptographicBuffer::DecodeFromHexString("0000000000000000000000000000000000000000000000000000000000000000"), &data); CryptographicBuffer::CopyToByteArray(CryptographicBuffer::DecodeFromHexString("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f"), &iv); CryptographicBuffer::CopyToByteArray(CryptographicBuffer::DecodeFromHexString("000102030405060708090a0b0c0d0e0f"), &key); diff --git a/tests/MockReflector.cpp b/tests/MockReflector.cpp index d12b28c2..d5a2e424 100644 --- a/tests/MockReflector.cpp +++ b/tests/MockReflector.cpp @@ -37,7 +37,7 @@ MockReflector::MockReflector(std::string bindAddress, uint16_t bindPort){ } MockReflector::~MockReflector(){ - + } std::array, 2> MockReflector::GeneratePeerTags(){ @@ -98,7 +98,7 @@ void MockReflector::RunThread(){ dest=&c.addr1; } clients[tagID]=c; - + if(specialID[0]==-1 && specialID[1]==-1 && specialID[2]==-1){ if(specialID[3]==-1){ continue; @@ -115,13 +115,13 @@ void MockReflector::RunThread(){ continue; } } - + if(dest->sin_family==AF_INET && !dropAllPackets){ if(peerTag[15] & 1) buf[15] &= 0xFE; else buf[15] |= 1; - + sendto(sfd, buf.data(), len, 0, (struct sockaddr*)dest, sizeof(sockaddr_in)); } } diff --git a/tests/MockReflector.h b/tests/MockReflector.h index b52219ae..41a4d4b7 100644 --- a/tests/MockReflector.h +++ b/tests/MockReflector.h @@ -31,7 +31,7 @@ namespace tgvoip{ void Stop(); void SetDropAllPackets(bool drop); static std::array, 2> GeneratePeerTags(); - + private: void RunThread(); struct ClientPair{ diff --git a/tests/libtgvoipTests.mm b/tests/libtgvoipTests.mm index cbb9c549..c05e0389 100644 --- a/tests/libtgvoipTests.mm +++ b/tests/libtgvoipTests.mm @@ -31,15 +31,15 @@ - (void)setUp { } - (void)tearDown { - - + + [super tearDown]; } - (void)initControllers{ controller1=new VoIPController(); controller2=new VoIPController(); - + std::array, 2> peerTags=test::MockReflector::GeneratePeerTags(); std::vector endpoints1; IPv4Address localhost("127.0.0.1"); @@ -49,7 +49,7 @@ - (void)initControllers{ std::vector endpoints2; endpoints2.push_back(Endpoint(1, 1033, localhost, emptyV6, Endpoint::Type::UDP_RELAY, peerTags[1].data())); controller2->SetRemoteEndpoints(endpoints2, false, 76); - + char encryptionKey[256]; RAND_bytes((uint8_t*)encryptionKey, sizeof(encryptionKey)); controller1->SetEncryptionKey(encryptionKey, true); @@ -67,64 +67,64 @@ - (void)testBasicOperation { webrtc::WavReader wavReader1(testWavFilePath); webrtc::WavReader wavReader2(testWavFilePath); webrtc::WavWriter wavWriter("output.wav", 48000, 1); - + test::MockReflector reflector("127.0.0.1", 1033); reflector.Start(); - + [self initControllers]; - + controller1->SetAudioDataCallbacks([&wavReader1](int16_t* data, size_t len){ wavReader1.ReadSamples(len, data); }, [](int16_t* data, size_t len){ - + }); - + controller2->SetAudioDataCallbacks([&wavReader2](int16_t* data, size_t len){ wavReader2.ReadSamples(len, data); }, [&wavWriter](int16_t* data, size_t len){ wavWriter.WriteSamples(data, len); }); - + controller1->Start(); controller2->Start(); controller1->Connect(); controller2->Connect(); [NSThread sleepForTimeInterval:10.0]; - + [self destroyControllers]; - + reflector.Stop(); } - (void)testAllocationAndDeallocation{ test::MockReflector reflector("127.0.0.1", 1033); reflector.Start(); - + for(int i=0;i<10;i++){ webrtc::WavReader wavReader(testWavFilePath); [self initControllers]; - + controller1->SetAudioDataCallbacks([&wavReader](int16_t* data, size_t len){ wavReader.ReadSamples(len, data); }, [](int16_t* data, size_t len){ - + }); - + controller2->SetAudioDataCallbacks([](int16_t* data, size_t len){ - + }, [](int16_t* data, size_t len){ - + }); - + controller1->Start(); controller2->Start(); controller1->Connect(); controller2->Connect(); [NSThread sleepForTimeInterval:3.0]; - + [self destroyControllers]; } - + reflector.Stop(); } @@ -149,20 +149,20 @@ - (void)testPacketTimeout{ test::MockReflector reflector("127.0.0.1", 1033); reflector.Start(); [self initControllers]; - + webrtc::WavReader wavReader(testWavFilePath); controller1->SetAudioDataCallbacks([&wavReader](int16_t* data, size_t len){ wavReader.ReadSamples(len, data); }, [](int16_t* data, size_t len){ - + }); - + controller2->SetAudioDataCallbacks([](int16_t* data, size_t len){ - + }, [](int16_t* data, size_t len){ - + }); - + VoIPController::Config config; config.enableNS=config.enableAEC=config.enableAGC=false; config.enableCallUpgrade=false; @@ -171,7 +171,7 @@ - (void)testPacketTimeout{ controller1->SetConfig(config); config.recvTimeout=5.0; controller2->SetConfig(config); - + controller1->Start(); controller2->Start(); controller1->Connect(); @@ -184,7 +184,7 @@ - (void)testPacketTimeout{ XCTAssertEqual(controller1->GetConnectionState(), STATE_FAILED); XCTAssertEqual(controller1->GetLastError(), ERROR_TIMEOUT); XCTAssertEqual(controller2->GetConnectionState(), STATE_RECONNECTING); - + [self destroyControllers]; reflector.Stop(); } diff --git a/threading.h b/threading.h index 52a09ff2..f6163e90 100755 --- a/threading.h +++ b/threading.h @@ -122,31 +122,31 @@ class Semaphore{ Semaphore(unsigned int maxCount, unsigned int initValue){ sem = dispatch_semaphore_create(initValue); } - + ~Semaphore(){ #if ! __has_feature(objc_arc) dispatch_release(sem); #endif } - + void Acquire(){ dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); } - + void Release(){ dispatch_semaphore_signal(sem); } - + void Acquire(int count){ for(int i=0;i> 32) // // The reason to introduce this function is that, in case we can't use smlawb -// instruction (in MUL_ACCUM_1) due to input value range, we can still use +// instruction (in MUL_ACCUM_1) due to input value range, we can still use // smmla to save some cycles. static __inline int32_t MUL_ACCUM_2(int32_t tbl_value, diff --git a/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c b/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c index 673f10d4..9fce5971 100644 --- a/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c +++ b/webrtc_dsp/modules/audio_coding/codecs/isac/main/source/bandwidth_estimator.c @@ -526,7 +526,7 @@ int16_t WebRtcIsac_UpdateUplinkBwImpl( { if(index > 11) { - index -= 12; + index -= 12; /* compute the jitter estimate as decoded on the other side */ bwest_str->send_max_delay_avg = 0.9f * bwest_str->send_max_delay_avg + 0.1f * (float)MAX_ISAC_MD;