From d3c76269d29bb26ad92fc0853295271d217a30fe Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 8 Mar 2009 07:26:01 +0000 Subject: [PATCH] removed some qDebug(), less number of possible audio block sizes, fix for auto jitter buffer -> still not ready --- src/client.cpp | 13 +++++++++---- src/main.cpp | 2 +- src/server.cpp | 10 ++++++---- src/util.h | 11 ++++------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 1e43203c..ce439744 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -436,12 +436,17 @@ void CClient::UpdateSocketBufferSize() // divide by MIN_SERVER_BLOCK_DURATION_MS because this is the size of // one block in the jitter buffer -// TODO use max(audioMs, receivedNetpacketsMs) -const double dAudioBufferDurationMs = - iMonoBlockSizeSam / SYSTEM_SAMPLE_RATE * 1000; + // Use worst case scenario: We add the block size of input and + // output. This is not required if the smaller block size is a + // multiple of the bigger size, but in the general case where + // 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; const double dEstCurBufSet = ( dAudioBufferDurationMs + - 3 * ( CycleTimeVariance.GetStdDev() + 0.5 ) ) / + 2 * ( CycleTimeVariance.GetStdDev() + 0.5 ) ) / MIN_SERVER_BLOCK_DURATION_MS; // upper/lower hysteresis decision diff --git a/src/main.cpp b/src/main.cpp index 2de2ced4..d21d9aef 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -212,7 +212,7 @@ int main ( int argc, char** argv ) else { // only start application without using the GUI - cout << CAboutDlg::GetVersionAndNameStr ( false ).toStdString(); + cout << CAboutDlg::GetVersionAndNameStr ( false ).toStdString() << std::endl; app.exec(); } } diff --git a/src/server.cpp b/src/server.cpp index e57ae89c..290cbc1d 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -119,8 +119,9 @@ void CServer::Stop() const QString strLogStr = CLogTimeDate::toString() + ",, server stopped " "-------------------------------------"; - qDebug() << strLogStr; // on console - Logging << strLogStr; // in log file + QTextStream tsConsoloeStream ( stdout ); + tsConsoloeStream << strLogStr << endl; // on console + Logging << strLogStr; // in log file } void CServer::OnNewChannel ( CHostAddress ChanAddr ) @@ -129,8 +130,9 @@ void CServer::OnNewChannel ( CHostAddress ChanAddr ) const QString strLogStr = CLogTimeDate::toString() + ", " + ChanAddr.InetAddr.toString() + ", connected"; - qDebug() << strLogStr; // on console - Logging << strLogStr; // in log file + QTextStream tsConsoloeStream ( stdout ); + tsConsoloeStream << strLogStr << endl; // on console + Logging << strLogStr; // in log file } void CServer::OnTimer() diff --git a/src/util.h b/src/util.h index 9dd8d555..83df50fc 100755 --- a/src/util.h +++ b/src/util.h @@ -440,22 +440,19 @@ public: class CSndCrdBufferSizes { public: - static int GetNumOfBufferSizes() { return 30; } - // we use a conservative value as default, this value does not // give perfekt latency results but should work ok on most // sound cards and drivers static int GetDefaultIndex() { return 5; } + static int GetNumOfBufferSizes() { return 16; } static int GetBufferSizeFromIndex ( const int iIdx ) { - if ( ( iIdx >= 0 ) && ( iIdx < 30 ) ) + if ( ( iIdx >= 0 ) && ( iIdx < 16 ) ) { - const int pSizes[30] = { + const int pSizes[16] = { 96, 128, 160, 192, 224, 256, 288, 320, 352, - 384, 416, 448, 480, 512, 544, 576, 608, 640, - 672, 704, 736, 768, 800, 832, 864, 896, 928, - 960, 992, 1024 }; + 384, 416, 448, 480, 512, 768, 1024 }; return pSizes[iIdx]; }