From 17e78fab9525d62ccab5b2b9b2602e0376d443ee Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Wed, 11 Mar 2009 21:34:57 +0000 Subject: [PATCH] do not attenuate that much in the server, more fair reduction of quality parameters in the server --- src/channel.cpp | 11 +++++++---- src/server.cpp | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/channel.cpp b/src/channel.cpp index be2434b9..3d003e70 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -298,8 +298,11 @@ void CChannelSet::SetOutputParameters() break; } - int iCurCh = 0; - while ( ( iCurCh < USED_NUM_CHANNELS ) && ( !bUploadRateIsBelowLimit ) ) + // we try to set the worst parameters to the clients which connected + // the latest to the server, therefore we apply the new parameters to + // the last channels first + int iCurCh = USED_NUM_CHANNELS - 1; + while ( ( iCurCh >= 0 ) && ( !bUploadRateIsBelowLimit ) ) { if ( vecChannels[iCurCh].IsConnected() ) { @@ -312,8 +315,8 @@ void CChannelSet::SetOutputParameters() ( CalculateTotalUploadRateKbps() <= iUploadRateLimitKbps ); } - // next channel - iCurCh++; + // next channel (backwards counting) + iCurCh--; } // next trial index diff --git a/src/server.cpp b/src/server.cpp index 99ed019e..de216ec8 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -183,8 +183,8 @@ CVector CServer::ProcessData ( CVector >& vecvecdData, const int iNumClients = vecvecdData.Size(); - // 3 dB offset to avoid overload if all clients are set to gain 1 - const double dNorm = (double) 2.0; + // some offset to avoid overload when mixing clients together + const double dNorm = (double) 1.25; // mix all audio data from all clients together for ( int i = 0; i < MIN_SERVER_BLOCK_SIZE_SAMPLES; i++ )