diff --git a/os/darwin/AudioUnitIO.cpp b/os/darwin/AudioUnitIO.cpp index 334aba6..1da244b 100644 --- a/os/darwin/AudioUnitIO.cpp +++ b/os/darwin/AudioUnitIO.cpp @@ -10,6 +10,7 @@ #include "AudioOutputAudioUnit.h" #include "../../logging.h" #include "../../VoIPController.h" +#include "../../VoIPServerConfig.h" #define CHECK_AU_ERROR(res, msg) if(res!=noErr){ LOGE(msg": OSStatus=%d", (int)res); return; } #define BUFFER_SIZE 960 // 20 ms @@ -127,7 +128,7 @@ void AudioUnitIO::ActuallyConfigure(uint32_t sampleRate, uint32_t bitsPerSample, status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit input"); - flag=0; + flag=ServerConfig::GetSharedInstance()->GetBoolean("use_ios_vpio_agc", true) ? 1 : 0; status=AudioUnitSetProperty(unit, kAUVoiceIOProperty_VoiceProcessingEnableAGC, kAudioUnitScope_Global, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error disabling AGC"); diff --git a/os/posix/NetworkSocketPosix.cpp b/os/posix/NetworkSocketPosix.cpp index 7fa7063..a0ddd5f 100644 --- a/os/posix/NetworkSocketPosix.cpp +++ b/os/posix/NetworkSocketPosix.cpp @@ -26,6 +26,7 @@ NetworkSocketPosix::NetworkSocketPosix(NetworkProtocol protocol) : NetworkSocket nat64Present=false; switchToV6at=0; isV4Available=false; + fd=-1; useTCP=false; closing=false; @@ -232,8 +233,11 @@ void NetworkSocketPosix::Open(){ void NetworkSocketPosix::Close(){ closing=true; failed=true; - shutdown(fd, SHUT_RDWR); - close(fd); + + if (fd>=0) { + shutdown(fd, SHUT_RDWR); + close(fd); + } } void NetworkSocketPosix::Connect(NetworkAddress *address, uint16_t port){ @@ -263,7 +267,7 @@ void NetworkSocketPosix::Connect(NetworkAddress *address, uint16_t port){ return; } fd=socket(addr->sa_family, SOCK_STREAM, IPPROTO_TCP); - if(fd==0){ + if(fd<0){ LOGE("Error creating TCP socket: %d / %s", errno, strerror(errno)); failed=true; return; diff --git a/os/windows/AudioInputWASAPI.cpp b/os/windows/AudioInputWASAPI.cpp index ffe9cc2..e5d6217 100644 --- a/os/windows/AudioInputWASAPI.cpp +++ b/os/windows/AudioInputWASAPI.cpp @@ -278,8 +278,11 @@ void AudioInputWASAPI::ActuallySetCurrentDevice(std::string deviceID){ audioClient=audioClient2; #endif - - res = audioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST | 0x80000000/*AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM*/, 60 * 10000, 0, &format, NULL); + + + // {2C693079-3F59-49FD-964F-61C005EAA5D3} + const GUID guid = { 0x2c693079, 0x3f59, 0x49fd, { 0x96, 0x4f, 0x61, 0xc0, 0x5, 0xea, 0xa5, 0xd3 } }; + res = audioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST | 0x80000000/*AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM*/, 60 * 10000, 0, &format, &guid); CHECK_RES(res, "audioClient->Initialize"); uint32_t bufSize; diff --git a/os/windows/AudioOutputWASAPI.cpp b/os/windows/AudioOutputWASAPI.cpp index 3a60253..9536785 100644 --- a/os/windows/AudioOutputWASAPI.cpp +++ b/os/windows/AudioOutputWASAPI.cpp @@ -281,7 +281,9 @@ void AudioOutputWASAPI::ActuallySetCurrentDevice(std::string deviceID){ audioClient = audioClient2; #endif - res = audioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST | 0x80000000/*AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM*/, 60 * 10000, 0, &format, NULL); + // {2C693079-3F59-49FD-964F-61C005EAA5D3} + const GUID guid = { 0x2c693079, 0x3f59, 0x49fd, { 0x96, 0x4f, 0x61, 0xc0, 0x5, 0xea, 0xa5, 0xd3 } }; + res = audioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST | 0x80000000/*AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM*/, 60 * 10000, 0, &format, &guid); CHECK_RES(res, "audioClient->Initialize"); uint32_t bufSize; diff --git a/os/windows/CXWrapper.cpp b/os/windows/CXWrapper.cpp old mode 100644 new mode 100755 diff --git a/os/windows/CXWrapper.h b/os/windows/CXWrapper.h old mode 100644 new mode 100755 diff --git a/os/windows/NetworkSocketWinsock.cpp b/os/windows/NetworkSocketWinsock.cpp index 78a1e71..c575840 100644 --- a/os/windows/NetworkSocketWinsock.cpp +++ b/os/windows/NetworkSocketWinsock.cpp @@ -24,6 +24,7 @@ NetworkSocketWinsock::NetworkSocketWinsock(NetworkProtocol protocol) : NetworkSo switchToV6at=0; isV4Available=false; closing=false; + fd=INVALID_SOCKET; #ifdef TGVOIP_WINXP_COMPAT DWORD version=GetVersion(); @@ -271,7 +272,8 @@ void NetworkSocketWinsock::Open(){ void NetworkSocketWinsock::Close(){ closing=true; failed=true; - closesocket(fd); + if(fd!=INVALID_SOCKET) + closesocket(fd); } void NetworkSocketWinsock::OnActiveInterfaceChanged(){