parent
682362c6fe
commit
b7524918fa
|
|
@ -62,7 +62,7 @@ set (USE_EVS_CODEC OFF CACHE BOOL "Use EVS codec.")
|
|||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
set (OPENSSL_INCLUDE ${PLATFORM_LIBS}/openssl/1.0/include)
|
||||
set (OPENSSL_INCLUDE ${LIB_PLATFORM}/openssl/1.0/include)
|
||||
message ("Using OpenSSL include files from ${OPENSSL_INCLUDE}")
|
||||
|
||||
if (CMAKE_SYSTEM MATCHES "Windows*")
|
||||
|
|
@ -176,7 +176,7 @@ target_include_directories(rtphone
|
|||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/engine>
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libs
|
||||
${PLATFORM_LIBS}/opus/include
|
||||
${LIB_PLATFORM}/opus/include
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libs/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libs/speex/include
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <future>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
|
||||
class ThreadPool
|
||||
{
|
||||
|
|
@ -42,7 +43,7 @@ inline ThreadPool::ThreadPool(size_t threads)
|
|||
{
|
||||
for(;;)
|
||||
{
|
||||
std::function<void()> task;
|
||||
std::function<void()> task; bool task_assigned = false;
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->queue_mutex);
|
||||
|
|
@ -54,10 +55,13 @@ inline ThreadPool::ThreadPool(size_t threads)
|
|||
return;
|
||||
if(this->pause)
|
||||
continue;
|
||||
task = std::move(this->tasks.front());
|
||||
if (this->tasks.size())
|
||||
{
|
||||
task = std::move(this->tasks.front()); task_assigned = true;
|
||||
this->tasks.pop();
|
||||
}
|
||||
|
||||
}
|
||||
if (task_assigned)
|
||||
task();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ByteBuffer::ByteBuffer(const void* packetPtr, size_t packetSize, CopyBehavior be
|
|||
break;
|
||||
|
||||
case CopyBehavior::UseExternal:
|
||||
mDataPtr = (uint8_t*)packetPtr;
|
||||
mDataPtr = reinterpret_cast<uint8_t*>(const_cast<void*>(packetPtr));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -72,7 +72,6 @@ ByteBuffer& ByteBuffer::operator = (const ByteBuffer& src)
|
|||
mData = src.mData;
|
||||
mCopyBehavior = CopyBehavior::CopyMemory;
|
||||
syncPointer();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -98,7 +97,7 @@ size_t ByteBuffer::size() const
|
|||
|
||||
const uint8_t* ByteBuffer::data() const
|
||||
{
|
||||
return (const uint8_t*)mDataPtr;
|
||||
return reinterpret_cast<const uint8_t*>(mDataPtr);
|
||||
}
|
||||
|
||||
uint8_t* ByteBuffer::mutableData()
|
||||
|
|
@ -237,7 +236,7 @@ void ByteBuffer::initEmpty()
|
|||
|
||||
void ByteBuffer::syncPointer()
|
||||
{
|
||||
mDataPtr = mData.empty() ? nullptr : &mData[0];
|
||||
mDataPtr = mData.empty() ? nullptr : mData.data();
|
||||
mDataSize = mData.size();
|
||||
}
|
||||
|
||||
|
|
@ -259,7 +258,7 @@ BitReader::BitReader(const ByteBuffer &buffer)
|
|||
}
|
||||
|
||||
BitReader::BitReader(const void *input, size_t bytes)
|
||||
:mStream((const uint8_t*)input), mStreamLen(bytes), mStreamOffset(0), mCurrentBit(0)
|
||||
:mStream(reinterpret_cast<const uint8_t*>(input)), mStreamLen(bytes), mStreamOffset(0), mCurrentBit(0)
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
|
@ -296,7 +295,7 @@ uint32_t BitReader::readBits(size_t nrOfBits)
|
|||
|
||||
uint32_t result = 0;
|
||||
BitWriter bw(&result);
|
||||
for (int i=0; i<(int)nrOfBits; i++)
|
||||
for (int i=0; i<static_cast<int>(nrOfBits); i++)
|
||||
bw.writeBit(readBit());
|
||||
|
||||
return result;
|
||||
|
|
@ -308,7 +307,7 @@ size_t BitReader::readBits(void *output, size_t nrOfBits)
|
|||
nrOfBits = std::min(nrOfBits, mStreamOffset - mCurrentPosition);
|
||||
|
||||
BitWriter bw(output);
|
||||
for (int i=0; i<(int)nrOfBits; i++)
|
||||
for (int i=0; i<static_cast<int>(nrOfBits); i++)
|
||||
bw.writeBit(readBit());
|
||||
|
||||
return nrOfBits;
|
||||
|
|
@ -381,7 +380,7 @@ BufferReader::BufferReader(const ByteBuffer &buffer)
|
|||
{}
|
||||
|
||||
BufferReader::BufferReader(const void *input, size_t bytes)
|
||||
:mData((const uint8_t*)input), mSize(bytes), mIndex(0)
|
||||
:mData(reinterpret_cast<const uint8_t*>(input)), mSize(bytes), mIndex(0)
|
||||
{}
|
||||
|
||||
|
||||
|
|
@ -435,7 +434,7 @@ NetworkAddress BufferReader::readIp(int family)
|
|||
addr.sin_port = 0;
|
||||
readBuffer(&addr.sin_addr.s_addr, 4);
|
||||
|
||||
return NetworkAddress((sockaddr&)addr, sizeof(addr));
|
||||
return NetworkAddress(reinterpret_cast<sockaddr&>(addr), sizeof(addr));
|
||||
}
|
||||
else
|
||||
if (family == AF_INET6)
|
||||
|
|
@ -446,7 +445,7 @@ NetworkAddress BufferReader::readIp(int family)
|
|||
addr.sin6_port = 0;
|
||||
readBuffer(&addr.sin6_addr, 16);
|
||||
|
||||
return NetworkAddress((sockaddr&)addr, sizeof(addr));
|
||||
return NetworkAddress(reinterpret_cast<sockaddr&>(addr), sizeof(addr));
|
||||
}
|
||||
return NetworkAddress();
|
||||
}
|
||||
|
|
@ -458,7 +457,7 @@ size_t BufferReader::readBuffer(void* dataPtr, size_t dataSize)
|
|||
size_t available = mSize - mIndex;
|
||||
if (available < dataSize)
|
||||
dataSize = available;
|
||||
if (NULL != dataPtr)
|
||||
if (nullptr != dataPtr)
|
||||
memcpy(dataPtr, mData + mIndex, dataSize);
|
||||
|
||||
mIndex += dataSize;
|
||||
|
|
@ -497,7 +496,7 @@ BufferWriter::BufferWriter(ByteBuffer &buffer)
|
|||
{}
|
||||
|
||||
BufferWriter::BufferWriter(void *output)
|
||||
:mData((uint8_t*)output), mIndex(0)
|
||||
:mData(reinterpret_cast<uint8_t*>(output)), mIndex(0)
|
||||
{}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace ice
|
|||
protected:
|
||||
std::vector<uint8_t> mData; // Internal storage
|
||||
uint8_t* mDataPtr; // Pointer to internal storage or external data
|
||||
uint32_t mDataSize; // Used only for mCopyBehavior == UseExternal
|
||||
size_t mDataSize; // Used only for mCopyBehavior == UseExternal
|
||||
NetworkAddress mRemoteAddress; // Associates buffer with IP address
|
||||
int mComponent; // Associates buffer with component ID
|
||||
std::string mComment; // Comment's for this buffer - useful in debugging
|
||||
|
|
|
|||
Loading…
Reference in New Issue