Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7bd87a4
Added several compiler-reported fixes. Added some changes around perf…
Mar 14, 2018
2248a39
Merge branch 'upstream-dev' into dev-intel-fixes
Mar 14, 2018
fa2c75f
Reimplemented Smoother Event system into template-based
Mar 16, 2018
fa408da
Fixed bug in stransmit checks incorrect ptr. Added config-status gene…
Mar 22, 2018
1f07636
Added blocking belated time stats.
Mar 23, 2018
38464fc
Moved check-enabling to log settings functions. Enable check now chec…
May 28, 2018
c59e5a4
Upgraded to latest upstream
May 29, 2018
7376af4
Added some informational comments.
May 29, 2018
0eaa284
Fixed handling of 'mode' parameter when listener in SrtModel
Jun 14, 2018
4d20cea
Merge branch 'upstream' into dev-intel-fixes
Jun 14, 2018
5c059dc
Merge branch 'upstream' into dev-improve-log-performance
Jun 14, 2018
910d96f
Merge branch 'dev-intel-fixes' into dev-performance
Jun 14, 2018
53098f9
Merge branch 'dev-fix-testmedia-listener-handling' into dev-performance
Jun 14, 2018
742a474
Added FastDriftTracker for making a jumping-average. Extracted averag…
ethouris Jun 19, 2018
44d5504
Added smaller bugfixes
Jul 10, 2018
9f6ddf9
Added formal shift procedures in RcvBuf. Added in-loop-packet-check p…
Jul 12, 2018
f21d472
Merge branch 'dev-performance' of https://github.com/ethouris/srt int…
ethouris Nov 7, 2018
dae1c38
Fixed incorrect rights
Jan 22, 2019
0173656
Upgraded to latest upstream
Jan 22, 2019
c2f040e
Upgraded to latest upstream
Mar 20, 2019
e94e6a9
Fixed template problem around C++11 version of Ref
Mar 21, 2019
22c317c
Fixed problems on MSVC 2013 & 2015
Mar 25, 2019
9c550c1
Updated with latest upstream
ethouris Sep 17, 2019
a3e54ba
Updated after rebase
Nov 7, 2019
186745d
Fixed spaced-tab in cmakelist
Nov 7, 2019
a8fe753
Some cosmetic after-merge changes
Nov 8, 2019
a779ac2
Merge branch 'master' into dev-performance
Nov 13, 2019
9ba8c1e
Remerged and tested
Jan 17, 2024
1a06628
Post-merge fixes
Jan 17, 2024
6bc6bb5
Post self-review fixes
Jan 17, 2024
d5818ba
Updated after partial extraction
Jan 19, 2024
6c8504d
Updated and fixed
Sep 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
if (DEFINED WITH_COMPILER_PREFIX)
message(STATUS "Handling compiler with WITH_COMPILER_PREFIX=${WITH_COMPILER_PREFIX}")
# Check also type. Default is gcc.
if (NOT DEFINED WIHT_COMPILER_TYPE)
if (NOT DEFINED WITH_COMPILER_TYPE)
set (WITH_COMPILER_TYPE gcc)
endif()

Expand All @@ -135,6 +135,9 @@ if (DEFINED WITH_COMPILER_PREFIX)
elseif (${WITH_COMPILER_TYPE} STREQUAL cc)
set (CMAKE_C_COMPILER ${WITH_COMPILER_PREFIX}cc)
set (CMAKE_CXX_COMPILER ${WITH_COMPILER_PREFIX}c++)
elseif (${WITH_COMPILER_TYPE} STREQUAL icc)
set (CMAKE_C_COMPILER ${WITH_COMPILER_PREFIX}icc)
set (CMAKE_CXX_COMPILER ${WITH_COMPILER_PREFIX}icpc)
else()
# Use blindly <command> for C compiler and <command>++ for C++.
# At least this matches clang.
Expand Down
1 change: 0 additions & 1 deletion apps/socketoptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ const SocketOption srt_options [] {
{ "inputbw", 0, SRTO_INPUTBW, SocketOption::POST, SocketOption::INT64, nullptr},
{ "oheadbw", 0, SRTO_OHEADBW, SocketOption::POST, SocketOption::INT, nullptr},
{ "latency", 0, SRTO_LATENCY, SocketOption::PRE, SocketOption::INT, nullptr},
{ "tsbpddelay", 0, SRTO_TSBPDDELAY, SocketOption::PRE, SocketOption::INT, nullptr},
{ "tlpktdrop", 0, SRTO_TLPKTDROP, SocketOption::PRE, SocketOption::BOOL, nullptr},
{ "snddropdelay", 0, SRTO_SNDDROPDELAY, SocketOption::POST, SocketOption::INT, nullptr},
{ "nakreport", 0, SRTO_NAKREPORT, SocketOption::PRE, SocketOption::BOOL, nullptr},
Expand Down
17 changes: 17 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,23 @@ if { $saveopt != "" } {
error "Extra unhandled argument: $saveopt"
}

# Save the original call into config-status.sh

set ofd [open config-status.sh w]
puts $ofd "#!/bin/bash"
puts -nonewline $ofd "$argv0 "
foreach a $argv {
set len 1
if {[catch {llength $a} len] || $len > 1 } {
puts -nonewline $ofd "'$a' "
} else {
puts -nonewline $ofd "$a "
}
}
puts $ofd ""
close $ofd
file attributes config-status.sh -permissions +x

set cmakeopt ""

resolve_disablers
Expand Down
10 changes: 8 additions & 2 deletions configure-data.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,14 @@ proc GetCompilerCommand {} {
# --cmake-c[++]-compiler
# (cmake-toolchain-file will set things up without the need to check things here)

set compiler gcc
if { [info exists ::optval(--with-compiler-type)] } {
set compiler $::optval(--with-compiler-type)
}

if { [info exists ::optval(--with-compiler-prefix)] } {
set prefix $::optval(--with-compiler-prefix)
return ${prefix}gcc
return ${prefix}$compiler
}

if { [info exists ::optval(--cmake-c-compiler)] } {
Expand Down Expand Up @@ -204,6 +209,7 @@ proc postprocess {} {
# Check characteristics of the compiler - in particular, whether the target is different
# than the current target.
set compiler_path ""
set target_platform ""
set cmd [GetCompilerCommand]
if { $cmd != "" } {
set gcc_version [exec $cmd -v 2>@1]
Expand All @@ -218,7 +224,7 @@ proc postprocess {} {
}

if { $target_platform == "" } {
puts "NOTE: can't obtain target from gcc -v: $l"
puts "NOTE: can't obtain target from '[file tail $cmd] -v': $l - ASSUMING HOST compiler"
} else {
if { $target_platform != $::tcl_platform(machine) } {
puts "NOTE: foreign target type detected ($target)" ;# - setting CROSSCOMPILING flag"
Expand Down
5 changes: 5 additions & 0 deletions srtcore/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3081,25 +3081,29 @@ void setloglevel(LogLevel::type ll)
{
CGuard gg(srt_logger_config.mutex);
srt_logger_config.max_level = ll;
srt_logger_config.announce();
}

void addlogfa(LogFA fa)
{
CGuard gg(srt_logger_config.mutex);
srt_logger_config.enabled_fa.set(fa, true);
srt_logger_config.announce();
}

void dellogfa(LogFA fa)
{
CGuard gg(srt_logger_config.mutex);
srt_logger_config.enabled_fa.set(fa, false);
srt_logger_config.announce();
}

void resetlogfa(set<LogFA> fas)
{
CGuard gg(srt_logger_config.mutex);
for (int i = 0; i <= SRT_LOGFA_LASTNONE; ++i)
srt_logger_config.enabled_fa.set(i, fas.count(i));
srt_logger_config.announce();
}

void resetlogfa(const int* fara, size_t fara_size)
Expand All @@ -3108,6 +3112,7 @@ void resetlogfa(const int* fara, size_t fara_size)
srt_logger_config.enabled_fa.reset();
for (const int* i = fara; i != fara + fara_size; ++i)
srt_logger_config.enabled_fa.set(*i, true);
srt_logger_config.announce();
}

void setlogstream(std::ostream& stream)
Expand Down
147 changes: 100 additions & 47 deletions srtcore/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,13 +781,17 @@ void CRcvBuffer::countBytes(int pkts, int bytes, bool acked)

int CRcvBuffer::addData(CUnit* unit, int offset)
{
int pos = (m_iLastAckPos + offset) % m_iSize;
int pos = shift(m_iLastAckPos, offset);
if (m_pUnit[pos] != NULL)
{
return -1;
}

// If such a thing happened, there shouldn't be any packet
// on that position (should be removed as already delivered).
if (offset >= m_iMaxPos)
m_iMaxPos = offset + 1;

if (m_pUnit[pos] != NULL) {
return -1;
}
m_pUnit[pos] = unit;
countBytes(1, (int) unit->m_Packet.getLength());

Expand Down Expand Up @@ -892,25 +896,27 @@ int CRcvBuffer::readBufferToFile(fstream& ofs, int len)

void CRcvBuffer::ackData(int len)
{
{
int pkts = 0;
int bytes = 0;
for (int i = m_iLastAckPos, n = (m_iLastAckPos + len) % m_iSize; i != n; i = (i + 1) % m_iSize)
{
if (m_pUnit[i] == NULL)
continue;
int pkts = 0;
int bytes = 0;
int i_end = shift(m_iLastAckPos, len);

pkts++;
bytes += (int) m_pUnit[i]->m_Packet.getLength();
}
if (pkts > 0) countBytes(pkts, bytes, true);
}
m_iLastAckPos = (m_iLastAckPos + len) % m_iSize;
m_iMaxPos -= len;
if (m_iMaxPos < 0)
m_iMaxPos = 0;
for (int i = m_iLastAckPos; i != i_end; i = shift_forward(i))
{
if (m_pUnit[i] == NULL)
continue;

CTimer::triggerEvent();
pkts++;
bytes += (int) m_pUnit[i]->m_Packet.getLength();
}
if (pkts > 0)
countBytes(pkts, bytes, true);

m_iLastAckPos = i_end;
m_iMaxPos -= len;
if (m_iMaxPos < 0)
m_iMaxPos = 0;

CTimer::triggerEvent();
}

void CRcvBuffer::skipData(int len)
Expand All @@ -920,8 +926,8 @@ void CRcvBuffer::skipData(int len)
* to move both m_iStartPos and m_iLastAckPost
*/
if (m_iStartPos == m_iLastAckPos)
m_iStartPos = (m_iStartPos + len) % m_iSize;
m_iLastAckPos = (m_iLastAckPos + len) % m_iSize;
m_iStartPos = shift(m_iStartPos, len);
m_iLastAckPos = shift(m_iLastAckPos, len);
m_iMaxPos -= len;
if (m_iMaxPos < 0)
m_iMaxPos = 0;
Expand Down Expand Up @@ -994,7 +1000,7 @@ bool CRcvBuffer::getRcvFirstMsg(ref_t<uint64_t> r_tsbpdtime, ref_t<bool> r_passa
// 1. Check if the VERY FIRST PACKET is valid; if so then:
// - check if it's ready to play, return boolean value that marks it.

for (int i = m_iLastAckPos, n = (m_iLastAckPos + m_iMaxPos) % m_iSize; i != n; i = (i + 1) % m_iSize)
for (int i = m_iLastAckPos, n = shift(m_iLastAckPos, m_iMaxPos); i != n; i = shift_forward(i))
{
if ( !m_pUnit[i]
|| m_pUnit[i]->m_iFlag != CUnit::GOOD )
Expand Down Expand Up @@ -1038,63 +1044,91 @@ bool CRcvBuffer::getRcvFirstMsg(ref_t<uint64_t> r_tsbpdtime, ref_t<bool> r_passa
return false;
}

bool CRcvBuffer::getRcvReadyMsg(ref_t<uint64_t> tsbpdtime, ref_t<int32_t> curpktseq)
bool CRcvBuffer::getRcvReadyMsg(ref_t<uint64_t> r_tsbpdtime, ref_t<int32_t> r_curpktseq)
{
*tsbpdtime = 0;
int rmpkts = 0;
*r_tsbpdtime = 0;
int rmpkts = 0;
int rmbytes = 0;

#if ENABLE_HEAVY_LOGGING
string reason = "NOT RECEIVED";
for (int i = m_iStartPos, n = m_iLastAckPos; i != n; i = (i + 1) % m_iSize)

struct PerfStats
{
int iterations;
bool found;
PerfStats(): iterations(0), found(false)
{
}

~PerfStats()
{
LOGC(mglog.Debug, log << "getRcvReadyMsg: PROF: Ready packet "
<< (found ? "" : "NOT ") << "found; done " << iterations << " iterations");
}
} l_perf_stats;
#endif

for (int i = m_iStartPos, n = m_iLastAckPos; i != n; i = shift_forward(i))
{
bool freeunit = false;

#if ENABLE_HEAVY_LOGGING
++l_perf_stats.iterations;
#endif

CUnit*& r_pu = m_pUnit[i];
CUnit* pu = r_pu; // to be free of referring to the memory cell

/* Skip any invalid skipped/dropped packets */
if (m_pUnit[i] == NULL)
if (pu == NULL)
{
if (++ m_iStartPos == m_iSize)
m_iStartPos = 0;
m_iStartPos = shift_forward(m_iStartPos);
continue;
}

*curpktseq = m_pUnit[i]->m_Packet.getSeqNo();
CPacket& pkt = pu->m_Packet;
*r_curpktseq = pkt.getSeqNo();

if (m_pUnit[i]->m_iFlag != CUnit::GOOD)
if (pu->m_iFlag != CUnit::GOOD)
{
freeunit = true;
}
else
{
*tsbpdtime = getPktTsbPdTime(m_pUnit[i]->m_Packet.getMsgTimeStamp());
int64_t towait = (*tsbpdtime - CTimer::getTime());
*r_tsbpdtime = getPktTsbPdTime(pkt.getMsgTimeStamp());
int64_t towait = (*r_tsbpdtime - CTimer::getTime());
if (towait > 0)
{
HLOGC(mglog.Debug, log << "getRcvReadyMsg: found packet, but not ready to play (only in " << (towait/1000.0) << "ms)");
return false;
}

if (m_pUnit[i]->m_Packet.getMsgCryptoFlags() != EK_NOENC)
if (pkt.getMsgCryptoFlags() != EK_NOENC)
{
#if ENABLE_HEAVY_LOGGING
reason = "DECRYPTION FAILED";
#endif
freeunit = true; /* packet not decrypted */
}
else
{
HLOGC(mglog.Debug, log << "getRcvReadyMsg: packet seq=" << curpktseq.get() << " ready to play (delayed " << (-towait/1000.0) << "ms)");
#if ENABLE_HEAVY_LOGGING
l_perf_stats.found = true;
#endif
HLOGC(mglog.Debug, log << "getRcvReadyMsg: packet seq=" << r_curpktseq.get() << " ready to play (delayed " << (-towait/1000.0) << "ms)");
return true;
}
}

if (freeunit)
{
CUnit* tmp = m_pUnit[i];
m_pUnit[i] = NULL;
r_pu = NULL;
rmpkts++;
rmbytes += (int) tmp->m_Packet.getLength();
m_pUnitQueue->makeUnitFree(tmp);
rmbytes += (int) pkt.getLength();
m_pUnitQueue->makeUnitFree(pu);

if (++m_iStartPos == m_iSize)
m_iStartPos = 0;
m_iStartPos = shift_forward(m_iStartPos);
}
}

Expand Down Expand Up @@ -1143,8 +1177,27 @@ bool CRcvBuffer::isRcvDataReady(ref_t<uint64_t> tsbpdtime, ref_t<int32_t> curpkt
// if m_bTsbPdMode.
CPacket* CRcvBuffer::getRcvReadyPacket()
{
for (int i = m_iStartPos, n = m_iLastAckPos; i != n; i = (i + 1) % m_iSize)
#if ENABLE_HEAVY_LOGGING
struct PerfStats
{
int iterations;
bool found;
PerfStats(): iterations(0), found(false)
{
}

~PerfStats()
{
LOGC(mglog.Debug, log << "getRcvReadyPacket: PROF: Ready packet "
<< (found ? "" : "NOT ") << "found; done " << iterations << " iterations");
}
} l_perf_stats;
#endif
for (int i = m_iStartPos, n = m_iLastAckPos; i != n; i = shift_forward(i))
{
#if ENABLE_HEAVY_LOGGING
++l_perf_stats.iterations;
#endif
/*
* Skip missing packets that did not arrive in time.
*/
Expand Down Expand Up @@ -1263,7 +1316,7 @@ int CRcvBuffer::getRcvDataSize(int &bytes, int &timespan)
{
/* skip invalid entries */
int i,n;
for (i = m_iStartPos, n = m_iLastAckPos; i != n; i = (i + 1) % m_iSize)
for (i = m_iStartPos, n = m_iLastAckPos; i != n; i = shift_forward(i))
{
if ((NULL != m_pUnit[i]) && (CUnit::GOOD == m_pUnit[i]->m_iFlag))
break;
Expand Down Expand Up @@ -1338,7 +1391,7 @@ int CRcvBuffer::getRcvAvgPayloadSize() const

void CRcvBuffer::dropMsg(int32_t msgno, bool using_rexmit_flag)
{
for (int i = m_iStartPos, n = (m_iLastAckPos + m_iMaxPos) % m_iSize; i != n; i = (i + 1) % m_iSize)
for (int i = m_iStartPos, n = shift(m_iLastAckPos, m_iMaxPos); i != n; i = shift_forward(i))
if ((m_pUnit[i] != NULL)
&& (m_pUnit[i]->m_Packet.getMsgSeq(using_rexmit_flag) == msgno))
m_pUnit[i]->m_iFlag = CUnit::DROPPED;
Expand Down Expand Up @@ -1646,7 +1699,7 @@ int CRcvBuffer::readMsg(char* data, int len, ref_t<SRT_MSGCTRL> r_msgctl)
}

if (!passack)
m_iStartPos = (q + 1) % m_iSize;
m_iStartPos = shift_forward(q);

return len - rs;
}
Expand Down
Loading