From db19ed48bcd48c459aae3ab094158be5cf2dfd05 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 8 Mar 2009 09:01:01 +0000 Subject: [PATCH] bug fixes --- src/client.cpp | 12 ++++++++---- src/global.h | 2 +- src/server.cpp | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index ce439744..47ee83eb 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -271,7 +271,9 @@ void CClient::Init ( const int iPrefMonoBlockSizeSamIndexAtSndCrdSamRate ) vecdNetwData.Init ( iMonoBlockSizeSam ); // init response time evaluation - CycleTimeVariance.Init ( LEN_MOV_AV_RESPONSE ); + CycleTimeVariance.Init ( + TIME_MOV_AV_RESPONSE * SYSTEM_SAMPLE_RATE / iMonoBlockSizeSam ); + CycleTimeVariance.Reset(); AudioReverb.Clear(); @@ -428,7 +430,9 @@ void CClient::UpdateSocketBufferSize() // completely filled const double dHysteresis = 0.3; - if ( CycleTimeVariance.IsInitialized() ) +// it seems that it is better to update the jitter buffer as soon as possible +// even if the value is not optimal right from the beginning + if ( 1 ) // previously -> CycleTimeVariance.IsInitialized() { // calculate current buffer setting // TODO 2* seems not give optimal results, maybe use 3*? @@ -442,8 +446,8 @@ void CClient::UpdateSocketBufferSize() // the block sizes do not have this relation, we require to have // a minimum buffer size of the sum of both sizes const double dAudioBufferDurationMs = - ( iMonoBlockSizeSam + Channel.GetAudioBlockSizeIn() ) / - SYSTEM_SAMPLE_RATE * 1000; + ( iMonoBlockSizeSam + Channel.GetAudioBlockSizeIn() ) * 1000 / + SYSTEM_SAMPLE_RATE; const double dEstCurBufSet = ( dAudioBufferDurationMs + 2 * ( CycleTimeVariance.GetStdDev() + 0.5 ) ) / diff --git a/src/global.h b/src/global.h index 6d431cc6..af5e38cd 100755 --- a/src/global.h +++ b/src/global.h @@ -108,7 +108,7 @@ // length of the moving average buffer for response time measurement #define TIME_MOV_AV_RESPONSE 30 // seconds -#define LEN_MOV_AV_RESPONSE ( TIME_MOV_AV_RESPONSE * 1000 / MIN_SERVER_BLOCK_DURATION_MS ) +#define LEN_MOV_AV_RESPONSE_SERVER ( TIME_MOV_AV_RESPONSE * 1000 / MIN_SERVER_BLOCK_DURATION_MS ) // GUI definition: width/heigth size of LED pixmaps #define LED_WIDTH_HEIGHT_SIZE_PIXEL 20 diff --git a/src/server.cpp b/src/server.cpp index 290cbc1d..068ea2b3 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -37,7 +37,7 @@ CServer::CServer ( const QString& strLoggingFileName, vecsSendData.Init ( MIN_SERVER_BLOCK_SIZE_SAMPLES ); // init moving average buffer for response time evaluation - CycleTimeVariance.Init ( LEN_MOV_AV_RESPONSE ); + CycleTimeVariance.Init ( LEN_MOV_AV_RESPONSE_SERVER ); // connect timer timeout signal QObject::connect ( &Timer, SIGNAL ( timeout() ),