提交 22900858 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

clang-format: Use 2 spaces for indentation instead of 4

上级 7fc6a08a
...@@ -37,8 +37,8 @@ BreakStringLiterals: false ...@@ -37,8 +37,8 @@ BreakStringLiterals: false
ColumnLimit: 100 ColumnLimit: 100
CommentPragmas: 'NOLINT' CommentPragmas: 'NOLINT'
ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4 ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 4 ContinuationIndentWidth: 2
Cpp11BracedListStyle: false Cpp11BracedListStyle: false
DerivePointerAlignment: false DerivePointerAlignment: false
DisableFormat: false DisableFormat: false
......
...@@ -84,10 +84,7 @@ namespace RTC ...@@ -84,10 +84,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::UdpSocket::Listener. */ /* Pure virtual methods inherited from RTC::UdpSocket::Listener. */
public: public:
void OnPacketRecv( void OnPacketRecv(
RTC::UdpSocket* socket, RTC::UdpSocket* socket, const uint8_t* data, size_t len, const struct sockaddr* remoteAddr) override;
const uint8_t* data,
size_t len,
const struct sockaddr* remoteAddr) override;
/* Pure virtual methods inherited from RTC::TcpServer::Listener. */ /* Pure virtual methods inherited from RTC::TcpServer::Listener. */
public: public:
...@@ -101,9 +98,7 @@ namespace RTC ...@@ -101,9 +98,7 @@ namespace RTC
/* Pure virtual methods inherited from RTC::IceServer::Listener. */ /* Pure virtual methods inherited from RTC::IceServer::Listener. */
public: public:
void OnOutgoingStunMessage( void OnOutgoingStunMessage(
const RTC::IceServer* iceServer, const RTC::IceServer* iceServer, const RTC::StunMessage* msg, RTC::TransportTuple* tuple) override;
const RTC::StunMessage* msg,
RTC::TransportTuple* tuple) override;
void OnIceSelectedTuple(const RTC::IceServer* iceServer, RTC::TransportTuple* tuple) override; void OnIceSelectedTuple(const RTC::IceServer* iceServer, RTC::TransportTuple* tuple) override;
void OnIceConnected(const RTC::IceServer* iceServer) override; void OnIceConnected(const RTC::IceServer* iceServer) override;
void OnIceCompleted(const RTC::IceServer* iceServer) override; void OnIceCompleted(const RTC::IceServer* iceServer) override;
...@@ -182,7 +177,9 @@ namespace RTC ...@@ -182,7 +177,9 @@ namespace RTC
inline bool Transport::IsConnected() const inline bool Transport::IsConnected() const
{ {
return this->dtlsTransport->GetState() == RTC::DtlsTransport::DtlsState::CONNECTED; return (
this->selectedTuple != nullptr &&
this->dtlsTransport->GetState() == RTC::DtlsTransport::DtlsState::CONNECTED);
} }
inline void Transport::EnableRemb() inline void Transport::EnableRemb()
......
...@@ -18,10 +18,7 @@ namespace RTC ...@@ -18,10 +18,7 @@ namespace RTC
public: public:
virtual void OnPacketRecv( virtual void OnPacketRecv(
RTC::UdpSocket* socket, RTC::UdpSocket* socket, const uint8_t* data, size_t len, const struct sockaddr* remoteAddr) = 0;
const uint8_t* data,
size_t len,
const struct sockaddr* remoteAddr) = 0;
}; };
public: public:
......
...@@ -29,8 +29,7 @@ namespace Utils ...@@ -29,8 +29,7 @@ namespace Utils
inline bool IP::CompareAddresses(const struct sockaddr* addr1, const struct sockaddr* addr2) inline bool IP::CompareAddresses(const struct sockaddr* addr1, const struct sockaddr* addr2)
{ {
// Compare family. // Compare family.
if (addr1->sa_family != addr2->sa_family || if (addr1->sa_family != addr2->sa_family || (addr1->sa_family != AF_INET && addr1->sa_family != AF_INET6))
(addr1->sa_family != AF_INET && addr1->sa_family != AF_INET6))
{ {
return false; return false;
} }
...@@ -43,18 +42,13 @@ namespace Utils ...@@ -43,18 +42,13 @@ namespace Utils
switch (addr1->sa_family) switch (addr1->sa_family)
{ {
case AF_INET: case AF_INET:
if (std::memcmp( if (std::memcmp(&((struct sockaddr_in*)addr1)->sin_addr, &((struct sockaddr_in*)addr2)->sin_addr, 4) == 0)
&((struct sockaddr_in*)addr1)->sin_addr, &((struct sockaddr_in*)addr2)->sin_addr, 4) ==
0)
{ {
return true; return true;
} }
break; break;
case AF_INET6: case AF_INET6:
if (std::memcmp( if (std::memcmp(&((struct sockaddr_in6*)addr1)->sin6_addr, &((struct sockaddr_in6*)addr2)->sin6_addr, 16) == 0)
&((struct sockaddr_in6*)addr1)->sin6_addr,
&((struct sockaddr_in6*)addr2)->sin6_addr,
16) == 0)
{ {
return true; return true;
} }
......
...@@ -266,8 +266,8 @@ namespace Channel ...@@ -266,8 +266,8 @@ namespace Channel
// If here it means that jsonStart points to the beginning of a JSON string // If here it means that jsonStart points to the beginning of a JSON string
// with jsonLen bytes length, so recalculate readLen. // with jsonLen bytes length, so recalculate readLen.
readLen = reinterpret_cast<const uint8_t*>(jsonStart) - (this->buffer + this->msgStart) + readLen =
jsonLen + 1; reinterpret_cast<const uint8_t*>(jsonStart) - (this->buffer + this->msgStart) + jsonLen + 1;
Json::Value json; Json::Value json;
std::string jsonParseError; std::string jsonParseError;
......
...@@ -95,7 +95,8 @@ namespace RTC ...@@ -95,7 +95,8 @@ namespace RTC
MS_TRACE(); MS_TRACE();
// Generate a X509 certificate and private key (unless PEM files are provided). // Generate a X509 certificate and private key (unless PEM files are provided).
if (Settings::configuration.dtlsCertificateFile.empty() || if (
Settings::configuration.dtlsCertificateFile.empty() ||
Settings::configuration.dtlsPrivateKeyFile.empty()) Settings::configuration.dtlsPrivateKeyFile.empty())
{ {
GenerateCertificateAndPrivateKey(); GenerateCertificateAndPrivateKey();
...@@ -364,9 +365,7 @@ namespace RTC ...@@ -364,9 +365,7 @@ namespace RTC
// Require certificate from peer. // Require certificate from peer.
SSL_CTX_set_verify( SSL_CTX_set_verify(
DtlsTransport::sslCtx, DtlsTransport::sslCtx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, onSslCertificateVerify);
SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
onSslCertificateVerify);
// Set SSL info callback. // Set SSL info callback.
SSL_CTX_set_info_callback(DtlsTransport::sslCtx, onSslInfo); SSL_CTX_set_info_callback(DtlsTransport::sslCtx, onSslInfo);
...@@ -1013,8 +1012,7 @@ namespace RTC ...@@ -1013,8 +1012,7 @@ namespace RTC
MS_TRACE(); MS_TRACE();
MS_ASSERT( MS_ASSERT(
this->remoteFingerprint.algorithm != FingerprintAlgorithm::NONE, this->remoteFingerprint.algorithm != FingerprintAlgorithm::NONE, "remote fingerprint not set");
"remote fingerprint not set");
X509* certificate; X509* certificate;
uint8_t binaryFingerprint[EVP_MAX_MD_SIZE]; uint8_t binaryFingerprint[EVP_MAX_MD_SIZE];
......
...@@ -150,8 +150,7 @@ namespace RTC ...@@ -150,8 +150,7 @@ namespace RTC
NackInfo& nackInfo = it->second; NackInfo& nackInfo = it->second;
uint16_t seq = nackInfo.seq32 % (1 << 16); uint16_t seq = nackInfo.seq32 % (1 << 16);
if (filter == NackFilter::SEQ && nackInfo.sentAtTime == 0 && if (filter == NackFilter::SEQ && nackInfo.sentAtTime == 0 && this->lastSeq32 >= nackInfo.sendAtSeqNum)
this->lastSeq32 >= nackInfo.sendAtSeqNum)
{ {
nackInfo.retries++; nackInfo.retries++;
nackInfo.sentAtTime = now; nackInfo.sentAtTime = now;
......
...@@ -407,7 +407,8 @@ namespace RTC ...@@ -407,7 +407,8 @@ namespace RTC
for (auto& exten : this->rtpParameters.headerExtensions) for (auto& exten : this->rtpParameters.headerExtensions)
{ {
if (this->kind == RTC::Media::Kind::AUDIO && (ssrcAudioLevelId == 0u) && if (
this->kind == RTC::Media::Kind::AUDIO && (ssrcAudioLevelId == 0u) &&
exten.type == RTC::RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL) exten.type == RTC::RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL)
{ {
if (idMapping.find(exten.id) != idMapping.end()) if (idMapping.find(exten.id) != idMapping.end())
...@@ -528,8 +529,7 @@ namespace RTC ...@@ -528,8 +529,7 @@ namespace RTC
if (this->knownHeaderExtensions.ssrcAudioLevelId) if (this->knownHeaderExtensions.ssrcAudioLevelId)
{ {
packet->AddExtensionMapping( packet->AddExtensionMapping(
RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL, RtpHeaderExtensionUri::Type::SSRC_AUDIO_LEVEL, this->knownHeaderExtensions.ssrcAudioLevelId);
this->knownHeaderExtensions.ssrcAudioLevelId);
} }
if (this->knownHeaderExtensions.absSendTimeId) if (this->knownHeaderExtensions.absSendTimeId)
......
...@@ -177,9 +177,7 @@ namespace RTC ...@@ -177,9 +177,7 @@ namespace RTC
default: default:
MS_WARN_TAG( MS_WARN_TAG(
rtcp, rtcp, "unknown RTCP PS Feedback message type [packetType:%" PRIu8 "]", commonHeader->count);
"unknown RTCP PS Feedback message type [packetType:%" PRIu8 "]",
commonHeader->count);
} }
return packet; return packet;
......
...@@ -67,8 +67,7 @@ namespace RTC ...@@ -67,8 +67,7 @@ namespace RTC
// Check length. // Check length.
size_t len = static_cast<size_t>(ntohs(commonHeader->length) + 1) * 4; size_t len = static_cast<size_t>(ntohs(commonHeader->length) + 1) * 4;
if (len != sizeof(CommonHeader) + sizeof(FeedbackPacket::Header) + sizeof(Header) + if (len != sizeof(CommonHeader) + sizeof(FeedbackPacket::Header) + sizeof(Header) + (numSsrcs * sizeof(uint32_t)))
(numSsrcs * sizeof(uint32_t)))
{ {
MS_WARN_TAG( MS_WARN_TAG(
rtcp, "invalid payload size (%zu bytes) for the given number of ssrcs (%zu)", len, numSsrcs); rtcp, "invalid payload size (%zu bytes) for the given number of ssrcs (%zu)", len, numSsrcs);
......
...@@ -143,8 +143,7 @@ namespace RTC ...@@ -143,8 +143,7 @@ namespace RTC
break; break;
case RC_INCREASE: case RC_INCREASE:
if (this->avgMaxBitrateKbps >= 0 && if (this->avgMaxBitrateKbps >= 0 && incomingBitrateKbps > this->avgMaxBitrateKbps + 3 * stdMaxBitRate)
incomingBitrateKbps > this->avgMaxBitrateKbps + 3 * stdMaxBitRate)
{ {
ChangeRegion(RC_MAX_UNKNOWN); ChangeRegion(RC_MAX_UNKNOWN);
this->avgMaxBitrateKbps = -1.0; this->avgMaxBitrateKbps = -1.0;
...@@ -177,8 +176,8 @@ namespace RTC ...@@ -177,8 +176,8 @@ namespace RTC
// Avoid increasing the rate when over-using. // Avoid increasing the rate when over-using.
if (this->rateControlRegion != RC_MAX_UNKNOWN) if (this->rateControlRegion != RC_MAX_UNKNOWN)
{ {
newBitrateBps = static_cast<uint32_t>( newBitrateBps =
std::lround(this->beta * this->avgMaxBitrateKbps * 1000 + 0.5f)); static_cast<uint32_t>(std::lround(this->beta * this->avgMaxBitrateKbps * 1000 + 0.5f));
} }
newBitrateBps = std::min(newBitrateBps, this->currentBitrateBps); newBitrateBps = std::min(newBitrateBps, this->currentBitrateBps);
......
...@@ -42,7 +42,8 @@ namespace RTC ...@@ -42,7 +42,8 @@ namespace RTC
this->e[0][0] += this->processNoise[0]; this->e[0][0] += this->processNoise[0];
this->e[1][1] += this->processNoise[1]; this->e[1][1] += this->processNoise[1];
if ((currentHypothesis == BW_OVERUSING && this->offset < this->prevOffset) || if (
(currentHypothesis == BW_OVERUSING && this->offset < this->prevOffset) ||
(currentHypothesis == BW_UNDERUSING && this->offset > this->prevOffset)) (currentHypothesis == BW_UNDERUSING && this->offset > this->prevOffset))
{ {
this->e[1][1] += 10 * this->processNoise[1]; this->e[1][1] += 10 * this->processNoise[1];
...@@ -135,8 +136,8 @@ namespace RTC ...@@ -135,8 +136,8 @@ namespace RTC
const double beta = pow(1 - alpha, tsDelta * 30.0 / 1000.0); const double beta = pow(1 - alpha, tsDelta * 30.0 / 1000.0);
this->avgNoise = beta * this->avgNoise + (1 - beta) * residual; this->avgNoise = beta * this->avgNoise + (1 - beta) * residual;
this->varNoise = beta * this->varNoise + this->varNoise =
(1 - beta) * (this->avgNoise - residual) * (this->avgNoise - residual); beta * this->varNoise + (1 - beta) * (this->avgNoise - residual) * (this->avgNoise - residual);
if (this->varNoise < 1) if (this->varNoise < 1)
this->varNoise = 1; this->varNoise = 1;
} }
......
...@@ -136,7 +136,8 @@ namespace RTC ...@@ -136,7 +136,8 @@ namespace RTC
if (it->sendMeanMs == 0 || it->recvMeanMs == 0) if (it->sendMeanMs == 0 || it->recvMeanMs == 0)
continue; continue;
if (it->numAboveMinDelta > it->count / 2 && if (
it->numAboveMinDelta > it->count / 2 &&
(it->recvMeanMs - it->sendMeanMs <= 2.0f && it->sendMeanMs - it->recvMeanMs <= 5.0f)) (it->recvMeanMs - it->sendMeanMs <= 2.0f && it->sendMeanMs - it->recvMeanMs <= 5.0f))
{ {
int probeBitrateBps = std::min(it->GetSendBitrateBps(), it->GetRecvBitrateBps()); int probeBitrateBps = std::min(it->GetSendBitrateBps(), it->GetRecvBitrateBps());
...@@ -298,7 +299,8 @@ namespace RTC ...@@ -298,7 +299,8 @@ namespace RTC
// the sender. // the sender.
const size_t minProbePacketSize{ 200 }; const size_t minProbePacketSize{ 200 };
if (payloadSize > minProbePacketSize && if (
payloadSize > minProbePacketSize &&
(!this->remoteRate.ValidEstimate() || (!this->remoteRate.ValidEstimate() ||
nowMs - this->firstPacketTimeMs < InitialProbingIntervalMs)) nowMs - this->firstPacketTimeMs < InitialProbingIntervalMs))
{ {
...@@ -348,8 +350,7 @@ namespace RTC ...@@ -348,8 +350,7 @@ namespace RTC
{ {
// Check if it's time for a periodic update or if we should update because // Check if it's time for a periodic update or if we should update because
// of an over-use. // of an over-use.
if (this->lastUpdateMs == -1 || if (this->lastUpdateMs == -1 || nowMs - this->lastUpdateMs > this->remoteRate.GetFeedbackInterval())
nowMs - this->lastUpdateMs > this->remoteRate.GetFeedbackInterval())
{ {
updateEstimate = true; updateEstimate = true;
} }
......
...@@ -96,7 +96,8 @@ namespace RTC ...@@ -96,7 +96,8 @@ namespace RTC
{ {
uint32_t incomingBitrateBps = this->incomingBitrate.GetRate(nowMs); uint32_t incomingBitrateBps = this->incomingBitrate.GetRate(nowMs);
if ((incomingBitrateBps != 0u) && if (
(incomingBitrateBps != 0u) &&
(priorState != BW_OVERUSING || (priorState != BW_OVERUSING ||
GetRemoteRate()->TimeToReduceFurther(nowMs, incomingBitrateBps))) GetRemoteRate()->TimeToReduceFurther(nowMs, incomingBitrateBps)))
{ {
......
...@@ -184,8 +184,7 @@ namespace RTC ...@@ -184,8 +184,7 @@ namespace RTC
{ {
auto& codec = *it; auto& codec = *it;
if (codec.mime.IsFeatureCodec() && if (codec.mime.IsFeatureCodec() && codec.parameters.GetInteger(associatedPayloadType) == payloadType)
codec.parameters.GetInteger(associatedPayloadType) == payloadType)
{ {
return codec; return codec;
} }
......
...@@ -198,7 +198,8 @@ namespace RTC ...@@ -198,7 +198,8 @@ namespace RTC
{ {
auto& encoding = *it; auto& encoding = *it;
if ((encoding.ssrc == 0u) || (encoding.hasRtx && (encoding.rtx.ssrc == 0u)) || if (
(encoding.ssrc == 0u) || (encoding.hasRtx && (encoding.rtx.ssrc == 0u)) ||
(encoding.hasFec && (encoding.fec.ssrc == 0u))) (encoding.hasFec && (encoding.fec.ssrc == 0u)))
{ {
break; break;
......
...@@ -90,8 +90,7 @@ namespace RTC ...@@ -90,8 +90,7 @@ namespace RTC
{ {
MS_DEBUG_TAG( MS_DEBUG_TAG(
rtx, rtx,
"ignoring empty RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 "ignoring empty RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 " payload type: %" PRIu8 "]",
" payload type: %" PRIu8 "]",
packet->GetSsrc(), packet->GetSsrc(),
packet->GetSequenceNumber(), packet->GetSequenceNumber(),
packet->GetPayloadType()); packet->GetPayloadType());
...@@ -101,8 +100,8 @@ namespace RTC ...@@ -101,8 +100,8 @@ namespace RTC
MS_WARN_TAG( MS_WARN_TAG(
rtx, rtx,
"ignoring malformed RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 "ignoring malformed RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 " payload type: %" PRIu8
" payload type: %" PRIu8 "]", "]",
packet->GetSsrc(), packet->GetSsrc(),
packet->GetSequenceNumber(), packet->GetSequenceNumber(),
packet->GetPayloadType()); packet->GetPayloadType());
...@@ -112,8 +111,8 @@ namespace RTC ...@@ -112,8 +111,8 @@ namespace RTC
MS_DEBUG_TAG( MS_DEBUG_TAG(
rtx, rtx,
"received RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 "received RTX packet [ssrc: %" PRIu32 " seq: %" PRIu16 "] recovering original [ssrc: %" PRIu32
"] recovering original [ssrc: %" PRIu32 " seq: %" PRIu16 "]", " seq: %" PRIu16 "]",
this->rtxSsrc, this->rtxSsrc,
rtxSeq, rtxSeq,
packet->GetSsrc(), packet->GetSsrc(),
......
...@@ -238,8 +238,8 @@ namespace RTC ...@@ -238,8 +238,8 @@ namespace RTC
StunMessage::StunMessage( StunMessage::StunMessage(
Class klass, Method method, const uint8_t* transactionId, const uint8_t* data, size_t size) Class klass, Method method, const uint8_t* transactionId, const uint8_t* data, size_t size)
: klass(klass), method(method), transactionId(transactionId), : klass(klass), method(method), transactionId(transactionId), data(const_cast<uint8_t*>(data)),
data(const_cast<uint8_t*>(data)), size(size) size(size)
{ {
MS_TRACE(); MS_TRACE();
} }
...@@ -346,8 +346,8 @@ namespace RTC ...@@ -346,8 +346,8 @@ namespace RTC
// Check that USERNAME attribute begins with our local username plus ":". // Check that USERNAME attribute begins with our local username plus ":".
size_t localUsernameLen = localUsername.length(); size_t localUsernameLen = localUsername.length();
if (this->username.length() <= localUsernameLen || if (
this->username.at(localUsernameLen) != ':' || this->username.length() <= localUsernameLen || this->username.at(localUsernameLen) != ':' ||
(this->username.compare(0, localUsernameLen, localUsername) != 0)) (this->username.compare(0, localUsernameLen, localUsername) != 0))
return Authentication::UNAUTHORIZED; return Authentication::UNAUTHORIZED;
......
...@@ -119,8 +119,7 @@ namespace RTC ...@@ -119,8 +119,7 @@ namespace RTC
// Choose a random first port to start from. // Choose a random first port to start from.
initialPort = static_cast<uint16_t>(Utils::Crypto::GetRandomUInt( initialPort = static_cast<uint16_t>(Utils::Crypto::GetRandomUInt(
static_cast<uint32_t>(RTC::TcpServer::minPort), static_cast<uint32_t>(RTC::TcpServer::minPort), static_cast<uint32_t>(RTC::TcpServer::maxPort)));
static_cast<uint32_t>(RTC::TcpServer::maxPort)));
iteratingPort = initialPort; iteratingPort = initialPort;
...@@ -140,9 +139,7 @@ namespace RTC ...@@ -140,9 +139,7 @@ namespace RTC
if (!(*availablePorts)[iteratingPort]) if (!(*availablePorts)[iteratingPort])
{ {
MS_DEBUG_DEV( MS_DEBUG_DEV(
"port in use, trying again [port:%" PRIu16 ", attempt:%" PRIu16 "]", "port in use, trying again [port:%" PRIu16 ", attempt:%" PRIu16 "]", iteratingPort, attempt);
iteratingPort,
attempt);
// If we have tried all the ports in the range raise an error. // If we have tried all the ports in the range raise an error.
if (iteratingPort == initialPort) if (iteratingPort == initialPort)
...@@ -208,10 +205,7 @@ namespace RTC ...@@ -208,10 +205,7 @@ namespace RTC
(*availablePorts)[iteratingPort] = false; (*availablePorts)[iteratingPort] = false;
MS_DEBUG_DEV( MS_DEBUG_DEV(
"bind success [ip:%s, port:%" PRIu16 ", attempt:%" PRIu16 "]", "bind success [ip:%s, port:%" PRIu16 ", attempt:%" PRIu16 "]", listenIp, iteratingPort, attempt);
listenIp,
iteratingPort,
attempt);
return uvHandle; return uvHandle;
}; };
......
...@@ -623,9 +623,7 @@ namespace RTC ...@@ -623,9 +623,7 @@ namespace RTC
{ {
if (consumer->kind == RTC::Media::Kind::VIDEO) if (consumer->kind == RTC::Media::Kind::VIDEO)
{ {
MS_DEBUG_TAG( MS_DEBUG_TAG(rtx, "requesting fullframe for new Consumer since Transport already connected");
rtx,
"requesting fullframe for new Consumer since Transport already connected");
} }
consumer->RequestFullFrame(); consumer->RequestFullFrame();
...@@ -636,8 +634,7 @@ namespace RTC ...@@ -636,8 +634,7 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// If there is no selected tuple do nothing. if (!IsConnected())
if (this->selectedTuple == nullptr)
return; return;
// Ensure there is sending SRTP session. // Ensure there is sending SRTP session.
...@@ -661,8 +658,7 @@ namespace RTC ...@@ -661,8 +658,7 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// If there is no selected tuple do nothing. if (!IsConnected())
if (this->selectedTuple == nullptr)
return; return;
// Ensure there is sending SRTP session. // Ensure there is sending SRTP session.
...@@ -686,8 +682,7 @@ namespace RTC ...@@ -686,8 +682,7 @@ namespace RTC
{ {
MS_TRACE(); MS_TRACE();
// If there is no selected tuple do nothing. if (!IsConnected())
if (this->selectedTuple == nullptr)
return; return;
// Ensure there is sending SRTP session. // Ensure there is sending SRTP session.
...@@ -722,7 +717,8 @@ namespace RTC ...@@ -722,7 +717,8 @@ namespace RTC
// If still 'auto' then transition to 'server' if ICE is 'connected' or // If still 'auto' then transition to 'server' if ICE is 'connected' or
// 'completed'. // 'completed'.
case RTC::DtlsTransport::Role::AUTO: case RTC::DtlsTransport::Role::AUTO:
if (this->iceServer->GetState() == RTC::IceServer::IceState::CONNECTED || if (
this->iceServer->GetState() == RTC::IceServer::IceState::CONNECTED ||
this->iceServer->GetState() == RTC::IceServer::IceState::COMPLETED) this->iceServer->GetState() == RTC::IceServer::IceState::COMPLETED)
{ {
MS_DEBUG_TAG( MS_DEBUG_TAG(
...@@ -748,7 +744,8 @@ namespace RTC ...@@ -748,7 +744,8 @@ namespace RTC
// If 'server' then run the DTLS transport if ICE is 'connected' (not yet // If 'server' then run the DTLS transport if ICE is 'connected' (not yet
// USE-CANDIDATE) or 'completed'. // USE-CANDIDATE) or 'completed'.
case RTC::DtlsTransport::Role::SERVER: case RTC::DtlsTransport::Role::SERVER:
if (this->iceServer->GetState() == RTC::IceServer::IceState::CONNECTED || if (
this->iceServer->GetState() == RTC::IceServer::IceState::CONNECTED ||
this->iceServer->GetState() == RTC::IceServer::IceState::COMPLETED) this->iceServer->GetState() == RTC::IceServer::IceState::COMPLETED)
{ {
MS_DEBUG_TAG(dtls, "running DTLS transport in local role 'server'"); MS_DEBUG_TAG(dtls, "running DTLS transport in local role 'server'");
...@@ -898,7 +895,8 @@ namespace RTC ...@@ -898,7 +895,8 @@ namespace RTC
this->iceServer->ForceSelectedTuple(tuple); this->iceServer->ForceSelectedTuple(tuple);
// Check that DTLS status is 'connecting' or 'connected'. // Check that DTLS status is 'connecting' or 'connected'.
if (this->dtlsTransport->GetState() == DtlsTransport::DtlsState::CONNECTING || if (
this->dtlsTransport->GetState() == DtlsTransport::DtlsState::CONNECTING ||
this->dtlsTransport->GetState() == DtlsTransport::DtlsState::CONNECTED) this->dtlsTransport->GetState() == DtlsTransport::DtlsState::CONNECTED)
{ {
MS_DEBUG_DEV("DTLS data received, passing it to the DTLS transport"); MS_DEBUG_DEV("DTLS data received, passing it to the DTLS transport");
...@@ -1335,6 +1333,8 @@ namespace RTC ...@@ -1335,6 +1333,8 @@ namespace RTC
MS_TRACE(); MS_TRACE();
MS_DEBUG_TAG(dtls, "DTLS application data received [size:%zu]", len); MS_DEBUG_TAG(dtls, "DTLS application data received [size:%zu]", len);
// NOTE: No DataChannel support, si just ignore it.
} }
void Transport::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, uint32_t bitrate) void Transport::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs, uint32_t bitrate)
...@@ -1379,7 +1379,8 @@ namespace RTC ...@@ -1379,7 +1379,8 @@ namespace RTC
// has decreased abruptly. // has decreased abruptly.
if (now - this->lastEffectiveMaxBitrateAt > EffectiveMaxBitrateCheckInterval) if (now - this->lastEffectiveMaxBitrateAt > EffectiveMaxBitrateCheckInterval)
{ {
if ((bitrate != 0u) && (this->effectiveMaxBitrate != 0u) && if (
(bitrate != 0u) && (this->effectiveMaxBitrate != 0u) &&
static_cast<double>(effectiveBitrate) / static_cast<double>(this->effectiveMaxBitrate) < static_cast<double>(effectiveBitrate) / static_cast<double>(this->effectiveMaxBitrate) <
EffectiveMaxBitrateThresholdBeforeFullFrame) EffectiveMaxBitrateThresholdBeforeFullFrame)
{ {
......
...@@ -118,8 +118,7 @@ namespace RTC ...@@ -118,8 +118,7 @@ namespace RTC
// Choose a random port to start from. // Choose a random port to start from.
initialPort = static_cast<uint16_t>(Utils::Crypto::GetRandomUInt( initialPort = static_cast<uint16_t>(Utils::Crypto::GetRandomUInt(
static_cast<uint32_t>(RTC::UdpSocket::minPort), static_cast<uint32_t>(RTC::UdpSocket::minPort), static_cast<uint32_t>(RTC::UdpSocket::maxPort)));
static_cast<uint32_t>(RTC::UdpSocket::maxPort)));
iteratingPort = initialPort; iteratingPort = initialPort;
...@@ -139,9 +138,7 @@ namespace RTC ...@@ -139,9 +138,7 @@ namespace RTC
if (!(*availablePorts)[iteratingPort]) if (!(*availablePorts)[iteratingPort])
{ {
MS_DEBUG_DEV( MS_DEBUG_DEV(
"port in use, trying again [port:%" PRIu16 ", attempt:%" PRIu16 "]", "port in use, trying again [port:%" PRIu16 ", attempt:%" PRIu16 "]", iteratingPort, attempt);
iteratingPort,
attempt);
// If we have tried all the ports in the range raise an error. // If we have tried all the ports in the range raise an error.
if (iteratingPort == initialPort) if (iteratingPort == initialPort)
...@@ -207,10 +204,7 @@ namespace RTC ...@@ -207,10 +204,7 @@ namespace RTC
(*availablePorts)[iteratingPort] = false; (*availablePorts)[iteratingPort] = false;
MS_DEBUG_DEV( MS_DEBUG_DEV(
"bind success [ip:%s, port:%" PRIu16 ", attempt:%" PRIu16 "]", "bind success [ip:%s, port:%" PRIu16 ", attempt:%" PRIu16 "]", listenIp, iteratingPort, attempt);
listenIp,
iteratingPort,
attempt);
return uvHandle; return uvHandle;
}; };
......
...@@ -506,7 +506,8 @@ void Settings::SetDtlsCertificateAndPrivateKeyFiles() ...@@ -506,7 +506,8 @@ void Settings::SetDtlsCertificateAndPrivateKeyFiles()
{ {
MS_TRACE(); MS_TRACE();
if (Settings::configuration.dtlsCertificateFile.empty() || if (
Settings::configuration.dtlsCertificateFile.empty() ||
Settings::configuration.dtlsPrivateKeyFile.empty()) Settings::configuration.dtlsPrivateKeyFile.empty())
{ {
Settings::configuration.dtlsCertificateFile = ""; Settings::configuration.dtlsCertificateFile = "";
...@@ -622,9 +623,7 @@ bool isBindableIp(const std::string& ip, int family, int* bindErrno) ...@@ -622,9 +623,7 @@ bool isBindableIp(const std::string& ip, int family, int* bindErrno)
MS_ABORT("socket() failed: %s", std::strerror(errno)); MS_ABORT("socket() failed: %s", std::strerror(errno));
err = bind( err = bind(
bindSocket, bindSocket, reinterpret_cast<const struct sockaddr*>(&bindAddr), sizeof(struct sockaddr_in6));
reinterpret_cast<const struct sockaddr*>(&bindAddr),
sizeof(struct sockaddr_in6));
break; break;
default: default:
......
...@@ -94,10 +94,7 @@ namespace Utils ...@@ -94,10 +94,7 @@ namespace Utils
ret = HMAC_Final(&Crypto::hmacSha1Ctx, (uint8_t*)Crypto::hmacSha1Buffer, &resultLen); ret = HMAC_Final(&Crypto::hmacSha1Ctx, (uint8_t*)Crypto::hmacSha1Buffer, &resultLen);
MS_ASSERT( MS_ASSERT(
ret == 1, ret == 1, "OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes", key.c_str(), len);
"OpenSSL HMAC_Final() failed with key '%s' and data length %zu bytes",
key.c_str(),
len);
MS_ASSERT(resultLen == 20, "OpenSSL HMAC_Final() resultLen is %u instead of 20", resultLen); MS_ASSERT(resultLen == 20, "OpenSSL HMAC_Final() resultLen is %u instead of 20", resultLen);
return Crypto::hmacSha1Buffer; return Crypto::hmacSha1Buffer;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论