Skip to content

Commit

Permalink
[core] Moved congestion control into the srt namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Aug 9, 2021
1 parent f0aa009 commit 252337c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
9 changes: 6 additions & 3 deletions srtcore/congctl.cpp
Expand Up @@ -34,10 +34,11 @@
#include "logging.h"

using namespace std;
using namespace srt;
using namespace srt::sync;
using namespace srt_logging;

namespace srt {

SrtCongestionControlBase::SrtCongestionControlBase(CUDT* parent)
{
m_parent = parent;
Expand Down Expand Up @@ -399,7 +400,7 @@ class FileCC : public SrtCongestionControlBase
else
{
double inc = 0;
const int loss_bw = 2 * (1000000 / m_dLastDecPeriod); // 2 times last loss point
const int loss_bw = static_cast<int>(2 * (1000000 / m_dLastDecPeriod)); // 2 times last loss point
const int bw_pktps = min(loss_bw, m_parent->bandwidth());

int64_t B = (int64_t)(bw_pktps - 1000000.0 / m_dPktSndPeriod);
Expand Down Expand Up @@ -500,7 +501,7 @@ class FileCC : public SrtCongestionControlBase
m_bLoss = true;

// TODO: const int pktsInFlight = CSeqNo::seqoff(m_iLastAck, m_parent->sndSeqNo());
const int pktsInFlight = m_parent->SRTT() / m_dPktSndPeriod;
const int pktsInFlight = static_cast<int>(m_parent->SRTT() / m_dPktSndPeriod);
const int numPktsLost = m_parent->sndLossLength();
const int lost_pcent_x10 = pktsInFlight > 0 ? (numPktsLost * 1000) / pktsInFlight : 0;

Expand Down Expand Up @@ -656,3 +657,5 @@ SrtCongestion::~SrtCongestion()
{
dispose();
}

} // namespace srt
11 changes: 4 additions & 7 deletions srtcore/congctl.h
Expand Up @@ -17,10 +17,9 @@
#include <utility>

namespace srt {
class CUDT;
}
class SrtCongestionControlBase;

class CUDT;
class SrtCongestionControlBase;
typedef SrtCongestionControlBase* srtcc_create_t(srt::CUDT* parent);

class SrtCongestion
Expand Down Expand Up @@ -131,9 +130,7 @@ class SrtCongestion
};
};

namespace srt {
class CPacket;
}
class CPacket;

class SrtCongestionControlBase
{
Expand Down Expand Up @@ -224,6 +221,6 @@ class SrtCongestionControlBase
};



} // namespace srt

#endif
2 changes: 1 addition & 1 deletion srtcore/socketconfig.cpp
Expand Up @@ -570,7 +570,7 @@ struct CSrtConfigSetter<SRTO_CONGESTION>
if (val == "vod")
val = "file";

bool res = SrtCongestion::exists(val);
bool res = srt::SrtCongestion::exists(val);
if (!res)
throw CUDTException(MJ_NOTSUP, MN_INVAL, 0);

Expand Down

0 comments on commit 252337c

Please sign in to comment.