Skip to content

Commit

Permalink
[core] Added SRTO_ESTINPUTBW option
Browse files Browse the repository at this point in the history
to get estimated input bitrate

Co-authored-by: duB <jdube@haivision.com>
  • Loading branch information
maxsharabayko and jeandube committed Sep 11, 2020
1 parent 4e2ae60 commit ac0cfdb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions srtcore/core.cpp
Expand Up @@ -1060,6 +1060,17 @@ void CUDT::getOpt(SRT_SOCKOPT optName, void *optval, int &optlen)
optlen = sizeof(int32_t);
break;

case SRTO_ESTINPUTBW:
*(int64_t*)optval = 0LL;
if (m_pSndBuffer && m_pSndBuffer->getInRatePeriod() != 0)
{
// return sampled internally measured input bw
const int rate = m_pSndBuffer->getInputRate();
*(int64_t*)optval = rate;
}
optlen = sizeof(int64_t);
break;

case SRTO_STATE:
*(int32_t *)optval = s_UDTUnited.getStatus(m_SocketID);
optlen = sizeof(int32_t);
Expand Down
1 change: 1 addition & 0 deletions srtcore/core.h
Expand Up @@ -770,6 +770,7 @@ class CUDT
int m_iPeerTsbPdDelay_ms; // Tx delay that the peer uses to absorb burst in milliseconds
bool m_bTLPktDrop; // Enable Too-late Packet Drop
int64_t m_llInputBW; // Input stream rate (bytes/sec)
// 0: use internally estimated input bandwidth
int m_iOverheadBW; // Percent above input stream rate (applies if m_llMaxBW == 0)
bool m_bRcvNakReport; // Enable Receiver Periodic NAK Reports
int m_iIpV6Only; // IPV6_V6ONLY option (-1 if not set)
Expand Down
1 change: 1 addition & 0 deletions srtcore/srt.h
Expand Up @@ -218,6 +218,7 @@ typedef enum SRT_SOCKOPT {
SRTO_PEERVERSION, // Peer SRT Version (from SRT Handshake)
SRTO_CONNTIMEO = 36, // Connect timeout in msec. Caller default: 3000, rendezvous (x 10)
SRTO_DRIFTTRACER = 37, // Enable or disable drift tracer
SRTO_ESTINPUTBW = 38, // Internally estimated input rate
// (some space left)
SRTO_SNDKMSTATE = 40, // (GET) the current state of the encryption at the peer side
SRTO_RCVKMSTATE, // (GET) the current state of the encryption at the agent side
Expand Down

0 comments on commit ac0cfdb

Please sign in to comment.