From 79c83a4c134b518b022d7614526c91655ef514cf Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 21 Mar 2015 11:48:27 +0000 Subject: [PATCH] another improvement of auto jitter buffer detection in very bad network conditions --- ChangeLog | 2 ++ src/buffer.cpp | 22 +++++++++++++++++----- src/buffer.h | 1 + 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15d493db..6121bf42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 3.3.9 +- another improvement of auto jitter buffer detection in very bad + network conditions diff --git a/src/buffer.cpp b/src/buffer.cpp index 0d41e2aa..6f2bb4af 100755 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -150,11 +150,9 @@ void CNetBufWithStats::Init ( const int iNewBlockSize, ErrorRateStatistic[i].Init ( MAX_STATISTIC_COUNT, true ); } - // start initialization phase of IIR filtering, use a quarter the size - // of the error rate statistic buffers which should be ok for a good - // initialization value (initialization phase should be as short as - // possible - iInitCounter = MAX_STATISTIC_COUNT / 4; + // reset the initialization counter which controls the initialization + // phase length + ResetInitCounter(); // init auto buffer setting with a meaningful value, also init the // IIR parameter with this value @@ -164,6 +162,15 @@ void CNetBufWithStats::Init ( const int iNewBlockSize, } } +void CNetBufWithStats::ResetInitCounter() +{ + // start initialization phase of IIR filtering, use a quarter the size + // of the error rate statistic buffers which should be ok for a good + // initialization value (initialization phase should be as short as + // possible) + iInitCounter = MAX_STATISTIC_COUNT / 4; +} + bool CNetBufWithStats::Put ( const CVector& vecbyData, const int iInSize ) { @@ -250,6 +257,11 @@ void CNetBufWithStats::UpdateAutoSetting() { // in case no buffer is below bound, use largest buffer size iCurMaxUpDecision = viBufSizesForSim[NUM_STAT_SIMULATION_BUFFERS - 1]; + + // This is a worst case, something very bad had happened. Hopefully + // this was just temporary so that we initiate a new initialzation + // phase to get quickly back to normal buffer sizes (hopefully). + ResetInitCounter(); } diff --git a/src/buffer.h b/src/buffer.h index a29be43d..14b5b94d 100755 --- a/src/buffer.h +++ b/src/buffer.h @@ -418,6 +418,7 @@ public: protected: void UpdateAutoSetting(); + void ResetInitCounter(); // statistic (do not use the vector class since the classes do not have // appropriate copy constructor/operator)