From 14d782bf9f2437713634c655b91ebece31286ed7 Mon Sep 17 00:00:00 2001 From: Grishka Date: Sun, 16 Sep 2018 23:38:52 +0300 Subject: [PATCH] Fixes This makes some parts of #53 unnecessary, sorry Fela --- BlockingQueue.h | 2 ++ Buffers.h | 4 +++- JitterBuffer.cpp | 0 MessageThread.cpp | 9 +++++++++ OpusDecoder.cpp | 0 OpusDecoder.h | 0 OpusEncoder.cpp | 0 OpusEncoder.h | 0 VoIPController.cpp | 0 VoIPController.h | 0 libtgvoip.WP81.vcxproj | 8 +++++++- libtgvoip.WP81.vcxproj.filters | 0 os/windows/AudioInputWASAPI.cpp | 0 os/windows/WindowsSandboxUtils.h | 6 +++++- threading.h | 0 15 files changed, 26 insertions(+), 3 deletions(-) mode change 100644 => 100755 JitterBuffer.cpp mode change 100644 => 100755 OpusDecoder.cpp mode change 100644 => 100755 OpusDecoder.h mode change 100644 => 100755 OpusEncoder.cpp mode change 100644 => 100755 OpusEncoder.h mode change 100644 => 100755 VoIPController.cpp mode change 100644 => 100755 VoIPController.h mode change 100644 => 100755 libtgvoip.WP81.vcxproj.filters mode change 100644 => 100755 os/windows/AudioInputWASAPI.cpp mode change 100644 => 100755 threading.h diff --git a/BlockingQueue.h b/BlockingQueue.h index 01843485eb..df7eda3274 100644 --- a/BlockingQueue.h +++ b/BlockingQueue.h @@ -10,6 +10,7 @@ #include #include #include "threading.h" +#include "utils.h" using namespace std; @@ -18,6 +19,7 @@ namespace tgvoip{ template class BlockingQueue{ public: + TGVOIP_DISALLOW_COPY_AND_ASSIGN(BlockingQueue); BlockingQueue(size_t capacity) : semaphore(capacity, 0){ this->capacity=capacity; overflowCallback=NULL; diff --git a/Buffers.h b/Buffers.h index 23f4afab73..3c97b7dc8b 100644 --- a/Buffers.h +++ b/Buffers.h @@ -17,6 +17,7 @@ #include #include #include "threading.h" +#include "utils.h" namespace tgvoip{ class Buffer; @@ -48,9 +49,9 @@ namespace tgvoip{ class BufferOutputStream{ friend class Buffer; public: + TGVOIP_DISALLOW_COPY_AND_ASSIGN(BufferOutputStream); BufferOutputStream(size_t size); BufferOutputStream(unsigned char* buffer, size_t size); - BufferOutputStream(const BufferOutputStream& other)=delete; ~BufferOutputStream(); void WriteByte(unsigned char byte); void WriteInt64(int64_t i); @@ -86,6 +87,7 @@ namespace tgvoip{ class BufferPool{ public: + TGVOIP_DISALLOW_COPY_AND_ASSIGN(BufferPool); BufferPool(unsigned int size, unsigned int count); ~BufferPool(); unsigned char* Get(); diff --git a/JitterBuffer.cpp b/JitterBuffer.cpp old mode 100644 new mode 100755 diff --git a/MessageThread.cpp b/MessageThread.cpp index 6cda46117c..33b65cd57c 100755 --- a/MessageThread.cpp +++ b/MessageThread.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #ifndef _WIN32 #include @@ -22,7 +23,11 @@ MessageThread::MessageThread() : Thread(new MethodPointer(&Messag SetName("MessageThread"); #ifdef _WIN32 +#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY!=WINAPI_FAMILY_PHONE_APP event=CreateEvent(NULL, false, false, NULL); +#else + event=CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); +#endif #else pthread_cond_init(&cond, NULL); #endif @@ -59,7 +64,11 @@ void MessageThread::Run(void* arg){ #ifdef _WIN32 queueMutex.Unlock(); DWORD actualWaitTimeout=waitTimeout==DBL_MAX ? INFINITE : ((DWORD)round(waitTimeout*1000.0)); +#if !defined(WINAPI_FAMILY) || WINAPI_FAMILY!=WINAPI_FAMILY_PHONE_APP WaitForSingleObject(event, actualWaitTimeout); +#else + WaitForSingleObjectEx(event, actualWaitTimeout, false); +#endif // we don't really care if a context switch happens here and anything gets added to the queue by another thread // since any new no-delay messages will get delivered on this iteration anyway queueMutex.Lock(); diff --git a/OpusDecoder.cpp b/OpusDecoder.cpp old mode 100644 new mode 100755 diff --git a/OpusDecoder.h b/OpusDecoder.h old mode 100644 new mode 100755 diff --git a/OpusEncoder.cpp b/OpusEncoder.cpp old mode 100644 new mode 100755 diff --git a/OpusEncoder.h b/OpusEncoder.h old mode 100644 new mode 100755 diff --git a/VoIPController.cpp b/VoIPController.cpp old mode 100644 new mode 100755 diff --git a/VoIPController.h b/VoIPController.h old mode 100644 new mode 100755 diff --git a/libtgvoip.WP81.vcxproj b/libtgvoip.WP81.vcxproj index d94bf1ada5..ab0ba47933 100644 --- a/libtgvoip.WP81.vcxproj +++ b/libtgvoip.WP81.vcxproj @@ -127,7 +127,7 @@ NotUsing - _WINRT_DLL;TGVOIP_WP_SILVERLIGHT;NDEBUG;_CRT_SECURE_NO_WARNINGS;NOMINMAX;WEBRTC_APM_DEBUG_DUMP=0;TGVOIP_USE_CUSTOM_CRYPTO;%(PreprocessorDefinitions) + _WINRT_DLL;TGVOIP_WP_SILVERLIGHT;NDEBUG;_CRT_SECURE_NO_WARNINGS;NOMINMAX;WEBRTC_APM_DEBUG_DUMP=0;TGVOIP_USE_CUSTOM_CRYPTO;noexcept=;_ALLOW_KEYWORD_MACROS;%(PreprocessorDefinitions) pch.h $(IntDir)pch.pch /bigobj %(AdditionalOptions) @@ -143,6 +143,7 @@ + @@ -152,6 +153,7 @@ + @@ -159,6 +161,7 @@ + @@ -224,6 +227,7 @@ + @@ -233,6 +237,7 @@ + @@ -240,6 +245,7 @@ + diff --git a/libtgvoip.WP81.vcxproj.filters b/libtgvoip.WP81.vcxproj.filters old mode 100644 new mode 100755 diff --git a/os/windows/AudioInputWASAPI.cpp b/os/windows/AudioInputWASAPI.cpp old mode 100644 new mode 100755 diff --git a/os/windows/WindowsSandboxUtils.h b/os/windows/WindowsSandboxUtils.h index 54654f7c81..aeddca0767 100644 --- a/os/windows/WindowsSandboxUtils.h +++ b/os/windows/WindowsSandboxUtils.h @@ -1,10 +1,12 @@ - // // libtgvoip is free and unencumbered public domain software. // For more information, see http://unlicense.org or the UNLICENSE file // you should have received with this source code distribution. // +#ifndef LIBTGVOIP_WINDOWS_SANDBOX_UTILS +#define LIBTGVOIP_WINDOWS_SANDBOX_UTILS + #include #include #ifndef TGVOIP_WP_SILVERLIGHT @@ -36,3 +38,5 @@ namespace tgvoip { static IAudioClient2* ActivateAudioDevice(const wchar_t* devID, HRESULT* callResult, HRESULT* actResult); }; } + +#endif // LIBTGVOIP_WINDOWS_SANDBOX_UTILS diff --git a/threading.h b/threading.h old mode 100644 new mode 100755