mirror of
https://github.com/danog/libtgvoip.git
synced 2024-11-26 12:14:39 +01:00
Merge multiple fixes
This commit is contained in:
parent
72c288afa0
commit
b152e32208
125
TgVoip.cpp
125
TgVoip.cpp
@ -1,3 +1,5 @@
|
||||
#include <mutex>
|
||||
|
||||
#include "TgVoip.h"
|
||||
|
||||
#include "VoIPController.h"
|
||||
@ -73,17 +75,11 @@ tgvoip::CryptoFunctions tgvoip::VoIPController::crypto = {
|
||||
tgvoip_openssl_aes_ctr_encrypt,
|
||||
tgvoip_openssl_aes_cbc_encrypt,
|
||||
tgvoip_openssl_aes_cbc_decrypt};
|
||||
#else
|
||||
tgvoip::CryptoFunctions tgvoip::VoIPController::crypto; // set it yourself upon initialization
|
||||
#endif
|
||||
|
||||
class TgVoipImpl : public TgVoip
|
||||
{
|
||||
public:
|
||||
tgvoip::VoIPController *controller_;
|
||||
std::function<void(TgVoipState)> onStateUpdated_;
|
||||
std::function<void(int)> onSignalBarsUpdated_;
|
||||
|
||||
TgVoipImpl(
|
||||
std::vector<TgVoipEndpoint> const &endpoints,
|
||||
TgVoipPersistentState const &persistentState,
|
||||
@ -135,7 +131,7 @@ public:
|
||||
std::vector<tgvoip::Endpoint> mappedEndpoints;
|
||||
for (auto endpoint : endpoints)
|
||||
{
|
||||
tgvoip::Endpoint::Type mappedType = tgvoip::Endpoint::Type::UDP_RELAY;
|
||||
tgvoip::Endpoint::Type mappedType;
|
||||
switch (endpoint.type)
|
||||
{
|
||||
case TgVoipEndpointType::UdpRelay:
|
||||
@ -158,10 +154,10 @@ public:
|
||||
tgvoip::IPv4Address address(endpoint.host.ipv4);
|
||||
tgvoip::IPv6Address addressv6(endpoint.host.ipv6);
|
||||
|
||||
mappedEndpoints.push_back(tgvoip::Endpoint(endpoint.endpointId, endpoint.port, address, addressv6, mappedType, endpoint.peerTag));
|
||||
mappedEndpoints.emplace_back(endpoint.endpointId, endpoint.port, address, addressv6, mappedType, endpoint.peerTag);
|
||||
}
|
||||
|
||||
int mappedDataSaving = tgvoip::DATA_SAVING_NEVER;
|
||||
int mappedDataSaving;
|
||||
switch (config.dataSaving)
|
||||
{
|
||||
case TgVoipDataSaving::Mobile:
|
||||
@ -198,19 +194,23 @@ public:
|
||||
controller_->Connect();
|
||||
}
|
||||
|
||||
~TgVoipImpl() override = default;
|
||||
~TgVoipImpl()
|
||||
{
|
||||
}
|
||||
|
||||
void setOnStateUpdated(std::function<void(TgVoipState)> onStateUpdated)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_onStateUpdated);
|
||||
onStateUpdated_ = onStateUpdated;
|
||||
}
|
||||
|
||||
void setOnSignalBarsUpdated(std::function<void(int)> onSignalBarsUpdated)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_onSignalBarsUpdated);
|
||||
onSignalBarsUpdated_ = onSignalBarsUpdated;
|
||||
}
|
||||
|
||||
void setNetworkType(TgVoipNetworkType networkType)
|
||||
void setNetworkType(TgVoipNetworkType networkType) override
|
||||
{
|
||||
int mappedType;
|
||||
|
||||
@ -265,66 +265,67 @@ public:
|
||||
controller_->SetMicMute(muteMicrophone);
|
||||
}
|
||||
|
||||
void setEchoCancellationStrength(int strength) override {
|
||||
void setAudioOutputGainControlEnabled(bool enabled) override
|
||||
{
|
||||
controller_->SetAudioOutputGainControlEnabled(enabled);
|
||||
}
|
||||
|
||||
void setEchoCancellationStrength(int strength) override
|
||||
{
|
||||
controller_->SetEchoCancellationStrength(strength);
|
||||
}
|
||||
|
||||
std::string getLastError() override {
|
||||
switch (controller_->GetLastError()) {
|
||||
case tgvoip::ERROR_INCOMPATIBLE: return "ERROR_INCOMPATIBLE";
|
||||
case tgvoip::ERROR_TIMEOUT: return "ERROR_TIMEOUT";
|
||||
case tgvoip::ERROR_AUDIO_IO: return "ERROR_AUDIO_IO";
|
||||
case tgvoip::ERROR_PROXY: return "ERROR_PROXY";
|
||||
default: return "ERROR_UNKNOWN";
|
||||
std::string getLastError() override
|
||||
{
|
||||
switch (controller_->GetLastError())
|
||||
{
|
||||
case tgvoip::ERROR_INCOMPATIBLE:
|
||||
return "ERROR_INCOMPATIBLE";
|
||||
case tgvoip::ERROR_TIMEOUT:
|
||||
return "ERROR_TIMEOUT";
|
||||
case tgvoip::ERROR_AUDIO_IO:
|
||||
return "ERROR_AUDIO_IO";
|
||||
case tgvoip::ERROR_PROXY:
|
||||
return "ERROR_PROXY";
|
||||
default:
|
||||
return "ERROR_UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
std::string getVersion()
|
||||
{
|
||||
return controller_->GetVersion();
|
||||
}
|
||||
|
||||
TgVoipPersistentState getPersistentState()
|
||||
{
|
||||
std::vector<uint8_t> persistentStateValue = controller_->GetPersistentState();
|
||||
TgVoipPersistentState persistentState = {
|
||||
.value = persistentStateValue};
|
||||
|
||||
return persistentState;
|
||||
}
|
||||
|
||||
std::string getDebugInfo() override
|
||||
{
|
||||
return controller_->GetDebugString();
|
||||
}
|
||||
|
||||
int64_t getPreferredRelayId() override {
|
||||
int64_t getPreferredRelayId() override
|
||||
{
|
||||
return controller_->GetPreferredRelayID();
|
||||
}
|
||||
|
||||
TgVoipFinalState stop()
|
||||
TgVoipTrafficStats getTrafficStats() override
|
||||
{
|
||||
controller_->Stop();
|
||||
|
||||
auto debugLog = controller_->GetDebugLog();
|
||||
|
||||
tgvoip::VoIPController::TrafficStats stats;
|
||||
controller_->GetStats(&stats);
|
||||
|
||||
TgVoipTrafficStats trafficStats = {
|
||||
return {
|
||||
.bytesSentWifi = stats.bytesSentWifi,
|
||||
.bytesReceivedWifi = stats.bytesRecvdWifi,
|
||||
.bytesSentMobile = stats.bytesSentMobile,
|
||||
.bytesReceivedMobile = stats.bytesRecvdMobile};
|
||||
}
|
||||
|
||||
std::vector<uint8_t> persistentStateValue = controller_->GetPersistentState();
|
||||
TgVoipPersistentState persistentState = {
|
||||
.value = persistentStateValue};
|
||||
TgVoipPersistentState getPersistentState() override
|
||||
{
|
||||
return {controller_->GetPersistentState()};
|
||||
}
|
||||
|
||||
TgVoipFinalState stop() override
|
||||
{
|
||||
controller_->Stop();
|
||||
|
||||
TgVoipFinalState finalState = {
|
||||
.persistentState = persistentState,
|
||||
.debugLog = debugLog,
|
||||
.trafficStats = trafficStats,
|
||||
.persistentState = getPersistentState(),
|
||||
.debugLog = controller_->GetDebugLog(),
|
||||
.trafficStats = getTrafficStats(),
|
||||
.isRatingSuggested = controller_->NeedRate()};
|
||||
|
||||
delete controller_;
|
||||
@ -335,7 +336,9 @@ public:
|
||||
|
||||
static void controllerStateCallback(tgvoip::VoIPController *controller, int state)
|
||||
{
|
||||
TgVoipImpl *self = (TgVoipImpl *)controller->implData;
|
||||
TgVoipImpl *self = reinterpret_cast<TgVoipImpl *>(controller->implData);
|
||||
std::lock_guard<std::mutex> lock(self->m_onStateUpdated);
|
||||
|
||||
if (self->onStateUpdated_)
|
||||
{
|
||||
TgVoipState mappedState;
|
||||
@ -367,12 +370,20 @@ public:
|
||||
|
||||
static void signalBarsCallback(tgvoip::VoIPController *controller, int signalBars)
|
||||
{
|
||||
TgVoipImpl *self = (TgVoipImpl *)controller->implData;
|
||||
TgVoipImpl *self = reinterpret_cast<TgVoipImpl *>(controller->implData);
|
||||
std::lock_guard<std::mutex> lock(self->m_onSignalBarsUpdated);
|
||||
|
||||
if (self->onSignalBarsUpdated_)
|
||||
{
|
||||
self->onSignalBarsUpdated_(signalBars);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
tgvoip::VoIPController *controller_;
|
||||
std::function<void(TgVoipState)> onStateUpdated_;
|
||||
std::function<void(int)> onSignalBarsUpdated_;
|
||||
std::mutex m_onStateUpdated, m_onSignalBarsUpdated;
|
||||
};
|
||||
|
||||
std::function<void(std::string const &)> globalLoggingFunction;
|
||||
@ -384,7 +395,7 @@ void __tgvoip_call_tglog(const char *format, ...)
|
||||
|
||||
va_list vaCopy;
|
||||
va_copy(vaCopy, vaArgs);
|
||||
const int length = std::vsnprintf(NULL, 0, format, vaCopy);
|
||||
const int length = std::vsnprintf(nullptr, 0, format, vaCopy);
|
||||
va_end(vaCopy);
|
||||
|
||||
std::vector<char> zc(length + 1);
|
||||
@ -407,6 +418,16 @@ void TgVoip::setGlobalServerConfig(const std::string &serverConfig)
|
||||
tgvoip::ServerConfig::GetSharedInstance()->Update(serverConfig);
|
||||
}
|
||||
|
||||
int TgVoip::getConnectionMaxLayer()
|
||||
{
|
||||
return tgvoip::VoIPController::GetConnectionMaxLayer();
|
||||
}
|
||||
|
||||
std::string TgVoip::getVersion()
|
||||
{
|
||||
return tgvoip::VoIPController::GetVersion();
|
||||
}
|
||||
|
||||
TgVoip *TgVoip::makeInstance(
|
||||
TgVoipConfig const &config,
|
||||
TgVoipPersistentState const &persistentState,
|
||||
@ -442,6 +463,4 @@ TgVoip *TgVoip::makeInstance(
|
||||
);
|
||||
}
|
||||
|
||||
TgVoip::~TgVoip()
|
||||
{
|
||||
}
|
||||
TgVoip::~TgVoip() = default;
|
||||
|
8
TgVoip.h
8
TgVoip.h
@ -22,7 +22,7 @@ enum class TgVoipEndpointType
|
||||
TcpRelay
|
||||
};
|
||||
|
||||
struct TgVoipEndpointHost
|
||||
struct TgVoipEdpointHost
|
||||
{
|
||||
std::string ipv4;
|
||||
std::string ipv6;
|
||||
@ -31,7 +31,7 @@ struct TgVoipEndpointHost
|
||||
struct TgVoipEndpoint
|
||||
{
|
||||
int64_t endpointId;
|
||||
TgVoipEndpointHost host;
|
||||
TgVoipEdpointHost host;
|
||||
uint16_t port;
|
||||
TgVoipEndpointType type;
|
||||
unsigned char peerTag[16];
|
||||
@ -89,7 +89,11 @@ struct TgVoipConfig
|
||||
bool enableNS;
|
||||
bool enableAGC;
|
||||
bool enableCallUpgrade;
|
||||
#ifndef _WIN32
|
||||
std::string logPath;
|
||||
#else
|
||||
std::wstring logPath;
|
||||
#endif
|
||||
int maxApiLayer;
|
||||
};
|
||||
|
||||
|
4
aclocal.m4
vendored
4
aclocal.m4
vendored
@ -8963,11 +8963,11 @@ m4_define([lt_dict_filter],
|
||||
# serial 4221 ltversion.m4
|
||||
# This file is part of GNU Libtool
|
||||
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6.42-b88ce])
|
||||
m4_define([LT_PACKAGE_VERSION], [2.4.6.42-b88ce-dirty])
|
||||
m4_define([LT_PACKAGE_REVISION], [2.4.6.42])
|
||||
|
||||
AC_DEFUN([LTVERSION_VERSION],
|
||||
[macro_version='2.4.6.42-b88ce'
|
||||
[macro_version='2.4.6.42-b88ce-dirty'
|
||||
macro_revision='2.4.6.42'
|
||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
|
||||
_LT_DECL(, macro_revision, 0)
|
||||
|
2
configure
vendored
2
configure
vendored
@ -3270,7 +3270,7 @@ esac
|
||||
|
||||
|
||||
|
||||
macro_version='2.4.6.42-b88ce'
|
||||
macro_version='2.4.6.42-b88ce-dirty'
|
||||
macro_revision='2.4.6.42'
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ void AudioPacketSender::SendFrame(unsigned char *data, size_t len, unsigned char
|
||||
if (hasExtraFEC)
|
||||
{
|
||||
Buffer ecBuf(secondaryLen);
|
||||
ecBuf.CopyFrom(*secondaryDataBufPtr, 0, secondaryLen);
|
||||
ecBuf.CopyFromOtherBuffer(*secondaryDataBufPtr, secondaryLen);
|
||||
if (ecAudioPackets.size() == 4)
|
||||
{
|
||||
ecAudioPackets.pop_front();
|
||||
@ -135,7 +135,7 @@ void AudioPacketSender::SendFrame(unsigned char *data, size_t len, unsigned char
|
||||
if (PeerVersion() < 7 && secondaryLen && shittyInternetMode)
|
||||
{
|
||||
Buffer ecBuf(secondaryLen);
|
||||
ecBuf.CopyFrom(*secondaryDataBufPtr, 0, secondaryLen);
|
||||
ecBuf.CopyFromOtherBuffer(*secondaryDataBufPtr, secondaryLen);
|
||||
if (ecAudioPackets.size() == 4)
|
||||
{
|
||||
ecAudioPackets.pop_front();
|
||||
|
@ -99,11 +99,12 @@ EchoCanceller::EchoCanceller(bool enableAEC, bool enableNS, bool enableAGC)
|
||||
EchoCanceller::~EchoCanceller()
|
||||
{
|
||||
#ifndef TGVOIP_NO_DSP
|
||||
delete apm;
|
||||
delete audioFrame;
|
||||
farendQueue->Put(Buffer());
|
||||
bufferFarendThread->Join();
|
||||
delete bufferFarendThread;
|
||||
delete farendQueue;
|
||||
delete audioFrame;
|
||||
delete apm;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,15 @@ using namespace tgvoip;
|
||||
|
||||
void MediaStreamItf::SetCallback(size_t (*f)(unsigned char *, size_t, void *), void *param)
|
||||
{
|
||||
MutexGuard m(callbackMutex);
|
||||
|
||||
callback = f;
|
||||
callbackParam = param;
|
||||
}
|
||||
|
||||
size_t MediaStreamItf::InvokeCallback(unsigned char *data, size_t length)
|
||||
{
|
||||
MutexGuard m(callbackMutex);
|
||||
if (callback)
|
||||
return (*callback)(data, length, callbackParam);
|
||||
return 0;
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
private:
|
||||
size_t (*callback)(unsigned char *, size_t, void *) = NULL;
|
||||
void *callbackParam;
|
||||
Mutex callbackMutex;
|
||||
};
|
||||
|
||||
class AudioMixer : public MediaStreamItf
|
||||
|
@ -99,7 +99,7 @@ void JitterBuffer::PutInternal(jitter_packet_t *pkt, bool overwriteExisting)
|
||||
//LOGV("Found existing packet for timestamp %u, overwrite %d", pkt->timestamp, overwriteExisting);
|
||||
if (overwriteExisting)
|
||||
{
|
||||
slots[i].buffer.CopyFrom(pkt->buffer, pkt->size);
|
||||
slots[i].buffer.CopyFromOtherBuffer(pkt->buffer, pkt->size);
|
||||
slots[i].size = pkt->size;
|
||||
slots[i].isEC = pkt->isEC;
|
||||
}
|
||||
@ -113,7 +113,7 @@ void JitterBuffer::PutInternal(jitter_packet_t *pkt, bool overwriteExisting)
|
||||
outstandingDelayChange = 0;
|
||||
nextFetchTimestamp = static_cast<int64_t>(static_cast<int64_t>(pkt->timestamp) - step * minDelay);
|
||||
first = true;
|
||||
LOGI("jitter: resyncing, next timestamp = %lld (step=%d, minDelay=%f)", (long long int)nextFetchTimestamp, step, minDelay);
|
||||
LOGI("jitter: resyncing, next timestamp = %lld (step=%d, minDelay=%f)", (long long int)nextFetchTimestamp, step, (double)minDelay);
|
||||
}
|
||||
|
||||
for (i = 0; i < JITTER_SLOT_COUNT; i++)
|
||||
@ -194,7 +194,7 @@ void JitterBuffer::PutInternal(jitter_packet_t *pkt, bool overwriteExisting)
|
||||
slots[i].buffer = bufferPool.Get();
|
||||
slots[i].recvTimeDiff = time - prevRecvTime;
|
||||
slots[i].isEC = pkt->isEC;
|
||||
slots[i].buffer.CopyFrom(pkt->buffer, pkt->size);
|
||||
slots[i].buffer.CopyFromOtherBuffer(pkt->buffer, pkt->size);
|
||||
#ifdef TGVOIP_DUMP_JITTER_STATS
|
||||
fprintf(dump, "%u\t%.03f\t%d\t%.03f\t%.03f\t%.03f\n", pkt->timestamp, time, GetCurrentDelay(), lastMeasuredJitter, lastMeasuredDelay, minDelay);
|
||||
#endif
|
||||
@ -322,7 +322,7 @@ int JitterBuffer::GetInternal(jitter_packet_t *pkt, int offset, bool advance)
|
||||
{
|
||||
pkt->size = slots[i].size;
|
||||
pkt->timestamp = slots[i].timestamp;
|
||||
pkt->buffer.CopyFrom(slots[i].buffer, slots[i].size);
|
||||
pkt->buffer.CopyFromOtherBuffer(slots[i].buffer, slots[i].size);
|
||||
pkt->isEC = slots[i].isEC;
|
||||
}
|
||||
}
|
||||
@ -428,7 +428,7 @@ void JitterBuffer::Tick()
|
||||
if ((diff > 0 && dontIncMinDelay == 0) || (diff < 0 && dontDecMinDelay == 0))
|
||||
{
|
||||
//nextFetchTimestamp+=diff*(int32_t)step;
|
||||
minDelay += diff;
|
||||
minDelay.store(minDelay + diff);
|
||||
outstandingDelayChange += diff * 60;
|
||||
dontChangeDelay += 32;
|
||||
//LOGD("new delay from stddev %f", minDelay);
|
||||
|
@ -73,8 +73,8 @@ private:
|
||||
Mutex mutex;
|
||||
uint32_t step;
|
||||
std::array<jitter_packet_t, JITTER_SLOT_COUNT> slots{0};
|
||||
std::atomic<int64_t> nextFetchTimestamp = ATOMIC_VAR_INIT(0); // What frame to read next
|
||||
double minDelay = 6;
|
||||
std::atomic<int64_t> nextFetchTimestamp{0}; // What frame to read next (protected for GetSeqTooLate)
|
||||
std::atomic<double> minDelay{6};
|
||||
uint32_t minMinDelay;
|
||||
uint32_t maxMinDelay;
|
||||
uint32_t maxUsedSlots;
|
||||
|
@ -64,7 +64,7 @@ void VoIPController::UpdateReliablePackets()
|
||||
if (qp->firstSentTime == 0)
|
||||
qp->firstSentTime = qp->lastSentTime;
|
||||
if (qp->data.Length())
|
||||
buf.CopyFrom(qp->data, qp->data.Length());
|
||||
buf.CopyFromOtherBuffer(qp->data, qp->data.Length());
|
||||
packetsToSend.push_back(PendingOutgoingPacket{
|
||||
/*.seq=*/seq,
|
||||
/*.type=*/qp->type,
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <string.h>
|
||||
#include <exception>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include "tools/logging.h"
|
||||
|
||||
using namespace tgvoip;
|
||||
@ -145,7 +145,7 @@ BufferOutputStream::BufferOutputStream(size_t size_)
|
||||
bufferProvided(false)
|
||||
|
||||
{
|
||||
buffer = (unsigned char *)malloc(size_);
|
||||
buffer = reinterpret_cast<unsigned char *>(std::malloc(size_));
|
||||
if (!buffer)
|
||||
throw std::bad_alloc();
|
||||
bufferProvided = false;
|
||||
@ -239,18 +239,16 @@ void BufferOutputStream::ExpandBufferIfNeeded(size_t need)
|
||||
{
|
||||
throw std::out_of_range("buffer overflow");
|
||||
}
|
||||
if (need < 1024)
|
||||
size += std::max(need, size_t{1024});
|
||||
unsigned char *newBuffer = reinterpret_cast<unsigned char*>(std::realloc(buffer, size));
|
||||
if (!newBuffer)
|
||||
{
|
||||
buffer = (unsigned char *)realloc(buffer, size + 1024);
|
||||
size += 1024;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = (unsigned char *)realloc(buffer, size + need);
|
||||
size += need;
|
||||
}
|
||||
if (!buffer)
|
||||
std::free(buffer);
|
||||
buffer = nullptr;
|
||||
size = 0;
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
buffer = newBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
{
|
||||
return data;
|
||||
}
|
||||
void CopyFrom(const Buffer &other, size_t count, size_t srcOffset = 0, size_t dstOffset = 0)
|
||||
void CopyFromOtherBuffer(const Buffer &other, size_t count, size_t srcOffset = 0, size_t dstOffset = 0)
|
||||
{
|
||||
if (!other.data)
|
||||
throw std::invalid_argument("CopyFrom can't copy from NULL");
|
||||
@ -248,7 +248,7 @@ public:
|
||||
if (other.IsEmpty())
|
||||
return Buffer();
|
||||
Buffer buf(other.length);
|
||||
buf.CopyFrom(other, other.length);
|
||||
buf.CopyFromOtherBuffer(other, other.length);
|
||||
return buf;
|
||||
}
|
||||
static Buffer CopyOf(const Buffer &other, size_t offset, size_t length)
|
||||
@ -256,7 +256,7 @@ public:
|
||||
if (offset + length > other.Length())
|
||||
throw std::out_of_range("offset+length out of bounds");
|
||||
Buffer buf(length);
|
||||
buf.CopyFrom(other, length, offset);
|
||||
buf.CopyFromOtherBuffer(other, length, offset);
|
||||
return buf;
|
||||
}
|
||||
static Buffer Wrap(unsigned char *data, size_t size, const std::function<void(void *)> &freeFn, const std::function<void *(void *, size_t)> &reallocFn)
|
||||
|
@ -18,9 +18,8 @@
|
||||
|
||||
using namespace tgvoip;
|
||||
|
||||
MessageThread::MessageThread() : Thread(std::bind(&MessageThread::Run, this))
|
||||
MessageThread::MessageThread() : Thread(std::bind(&MessageThread::Run, this)), running(true)
|
||||
{
|
||||
running = true;
|
||||
SetName("MessageThread");
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -27,7 +27,7 @@ Buffer ParityFEC::Encode(std::vector<Buffer>& packets){
|
||||
_result[maxSize+1] ^= (uint8_t)(len >> 8);
|
||||
}
|
||||
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Buffer ParityFEC::Decode(std::vector<Buffer>& dataPackets, Buffer &fecPacket){
|
||||
@ -68,5 +68,5 @@ Buffer ParityFEC::Decode(std::vector<Buffer>& dataPackets, Buffer &fecPacket){
|
||||
LOGV("ParityFEC decoded packet size %u", len);
|
||||
|
||||
result.Resize(len);
|
||||
return std::move(result);
|
||||
return result;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ size_t WebRtcSpl_FilterAR(const int16_t* a,
|
||||
// because of this.
|
||||
int filtered_ix = (int)i - 1;
|
||||
int16_t* state_ptr = &state[state_length - 1];
|
||||
int16_t* state_low_ptr = &state_low[state_length - 1];
|
||||
int16_t* state_low_ptr = &state_low[state_low_length - 1];
|
||||
|
||||
o = (int32_t)(*x_ptr++) * (1 << 12);
|
||||
oLOW = (int32_t)0;
|
||||
@ -87,7 +87,7 @@ size_t WebRtcSpl_FilterAR(const int16_t* a,
|
||||
for (i = 0; i < x_length; i++)
|
||||
{
|
||||
state[state_length - x_length + i] = filtered[i];
|
||||
state[state_length - x_length + i] = filtered_low[i];
|
||||
state_low[state_low_length - x_length + i] = filtered_low[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ struct TypeOr {
|
||||
"The specified type isn't large enough");
|
||||
static_assert(IsIntlike<type>::value == IsIntlike<B>::value &&
|
||||
std::is_floating_point<type>::value ==
|
||||
std::is_floating_point<type>::value,
|
||||
std::is_floating_point<B>::value,
|
||||
"float<->int conversions not allowed");
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user