1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-12-02 09:37:52 +01:00

Merge branch 'public' of https://github.com/grishka/libtgvoip into public

This commit is contained in:
Daniil Gentili 2017-07-27 19:01:11 +02:00
commit 5b3248482e
7 changed files with 20 additions and 8 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

0
os/windows/CXWrapper.cpp Normal file → Executable file
View File

0
os/windows/CXWrapper.h Normal file → Executable file
View File

View File

@ -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(){