From 31fe4afdd09123e3a3bce8d8a736624808ef544b Mon Sep 17 00:00:00 2001 From: Grishka Date: Tue, 28 Aug 2018 23:41:01 +0300 Subject: [PATCH] windows fixes --- VoIPController.cpp | 20 ++++++++++++++++++-- VoIPController.h | 5 +++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/VoIPController.cpp b/VoIPController.cpp index b82899e751..7fe0d01147 100644 --- a/VoIPController.cpp +++ b/VoIPController.cpp @@ -347,10 +347,14 @@ void VoIPController::Stop(){ { LOGD("Before stop audio I/O"); MutexGuard m(audioIOMutex); - if(audioInput) + if(audioInput){ audioInput->Stop(); - if(audioOutput) + audioInput->SetCallback(NULL, NULL); + } + if(audioOutput){ audioOutput->Stop(); + audioOutput->SetCallback(NULL, NULL); + } } LOGD("Left VoIPController::Stop"); } @@ -2375,7 +2379,13 @@ void VoIPController::SetConfig(const Config& cfg){ tgvoipLogFile=NULL; } if(!config.logFilePath.empty()){ +#ifndef _WIN32 tgvoipLogFile=fopen(config.logFilePath.c_str(), "a"); +#else + if(_wfopen_s(&tgvoipLogFile, config.logFilePath.c_str(), L"a")!=0){ + tgvoipLogFile=NULL; + } +#endif tgvoip_log_file_write_header(tgvoipLogFile); }else{ tgvoipLogFile=NULL; @@ -2385,7 +2395,13 @@ void VoIPController::SetConfig(const Config& cfg){ statsDump=NULL; } if(!config.statsDumpFilePath.empty()){ +#ifndef _WIN32 statsDump=fopen(config.statsDumpFilePath.c_str(), "w"); +#else + if(_wfopen_s(&statsDump, config.statsDumpFilePath.c_str(), L"w")!=0){ + statsDump=NULL; + } +#endif if(statsDump) fprintf(statsDump, "Time\tRTT\tLRSeq\tLSSeq\tLASeq\tLostR\tLostS\tCWnd\tBitrate\tLoss%%\tJitter\tJDelay\tAJDelay\n"); else diff --git a/VoIPController.h b/VoIPController.h index 954424b1f8..7f94c1477f 100644 --- a/VoIPController.h +++ b/VoIPController.h @@ -179,8 +179,13 @@ namespace tgvoip{ double initTimeout; double recvTimeout; int dataSaving; +#ifndef _WIN32 std::string logFilePath=""; std::string statsDumpFilePath=""; +#else + std::wstring logFilePath=L""; + std::wstring statsDumpFilePath=L""; +#endif bool enableAEC; bool enableNS;