fix overall delay calculation

This commit is contained in:
Volker Fischer 2015-03-13 21:18:09 +00:00
parent 115d9cefe0
commit d924380262
2 changed files with 9 additions and 12 deletions

View File

@ -1301,17 +1301,14 @@ fflush(pFileDelay);
int CClient::EstimatedOverallDelay ( const int iPingTimeMs ) int CClient::EstimatedOverallDelay ( const int iPingTimeMs )
{ {
/* // If the jitter buffers are set effectively, i.e. they are exactly the
For estimating the overall delay, use the following assumptions: // size of the network jitter, then the delay of the buffer is the buffer
- the mean delay of a cyclic buffer is half the buffer size (since // length. Since that is usually not the case but the buffers are usually
for the average it is assumed that the buffer is half filled) // a bit larger than necessary, we introduce some factor for compensation.
- consider the jitter buffer on the server side, too // Consider the jitter buffer on the client and on the server side, too.
*/
// the buffer sizes at client and server divided by 2 (half the buffer
// for the delay) is the total socket buffer size
const double dTotalJitterBufferDelayMs = SYSTEM_BLOCK_DURATION_MS_FLOAT * const double dTotalJitterBufferDelayMs = SYSTEM_BLOCK_DURATION_MS_FLOAT *
static_cast<double> ( GetSockBufNumFrames() + static_cast<double> ( GetSockBufNumFrames() +
GetServerSockBufNumFrames() ) / 2; GetServerSockBufNumFrames() ) * 0.8f;
// consider delay introduced by the sound card conversion buffer by using // consider delay introduced by the sound card conversion buffer by using
// "GetSndCrdConvBufAdditionalDelayMonoBlSize()" // "GetSndCrdConvBufAdditionalDelayMonoBlSize()"

View File

@ -928,16 +928,16 @@ void CClientDlg::OnPingTimeResult ( int iPingTime )
// calculate overall delay // calculate overall delay
const int iOverallDelayMs = pClient->EstimatedOverallDelay ( iPingTime ); const int iOverallDelayMs = pClient->EstimatedOverallDelay ( iPingTime );
// color definition: <= 40 ms green, <= 65 ms yellow, otherwise red // color definition: <= 42 ms green, <= 70 ms yellow, otherwise red
CMultiColorLED::ELightColor eOverallDelayLEDColor; CMultiColorLED::ELightColor eOverallDelayLEDColor;
if ( iOverallDelayMs <= 40 ) if ( iOverallDelayMs <= 42 )
{ {
eOverallDelayLEDColor = CMultiColorLED::RL_GREEN; eOverallDelayLEDColor = CMultiColorLED::RL_GREEN;
} }
else else
{ {
if ( iOverallDelayMs <= 65 ) if ( iOverallDelayMs <= 70 )
{ {
eOverallDelayLEDColor = CMultiColorLED::RL_YELLOW; eOverallDelayLEDColor = CMultiColorLED::RL_YELLOW;
} }