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++ )