diff --git a/src/server.cpp b/src/server.cpp index bb3e73f1..3de42c41 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -1041,6 +1041,7 @@ static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure(); // TE vecvecdPannings[i], vecNumAudioChannels, vecvecsIntermediateProcBuf[i], + vecvecsSendData[i], vecvecbyCodedData[i], vecChannels[iCurChanID], DoubleFrameSizeConvBufOut[iCurChanID], @@ -1050,8 +1051,7 @@ static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure(); // TE iCeltNumCodedBytes, iClientFrameSizeSamples, iCurNumAudChan, - iNumClients, - vecvecsSendData[i] ); + iNumClients ); // update socket buffer size vecChannels[iCurChanID].UpdateSocketBufferSize(); @@ -1091,6 +1091,7 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD const CVector& vecdPannings, const CVector& vecNumAudioChannels, CVector& vecdIntermProcBuf, + CVector& vecsSendData, CVector& vecbyCodedData, CChannel& Channel, CConvBuf& DoubleFrameSizeConvBufOut, @@ -1100,8 +1101,7 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD const int iCeltNumCodedBytes, const int iClientFrameSizeSamples, const int iCurNumAudChan, - const int iNumClients, - CVector& vecsOutData ) + const int iNumClients ) { int i, j, k, iUnused; @@ -1164,7 +1164,7 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD // convert from double to short with clipping for ( i = 0; i < iServerFrameSizeSamples; i++ ) { - vecsOutData[i] = Double2Short ( vecdIntermProcBuf[i] ); + vecsSendData[i] = Double2Short ( vecdIntermProcBuf[i] ); } } else @@ -1232,7 +1232,7 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD // convert from double to short with clipping for ( i = 0; i < ( 2 * iServerFrameSizeSamples ); i++ ) { - vecsOutData[i] = Double2Short ( vecdIntermProcBuf[i] ); + vecsSendData[i] = Double2Short ( vecdIntermProcBuf[i] ); } } @@ -1242,12 +1242,12 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD // is false and the Get() function is not called at all. Therefore if the buffer is not needed // we do not spend any time in the function but go directly inside the if condition. if ( ( iUseDoubleSysFraSizeConvBuf == 0 ) || - DoubleFrameSizeConvBufOut.Put ( vecsOutData, SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan ) ) + DoubleFrameSizeConvBufOut.Put ( vecsSendData, SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan ) ) { if ( iUseDoubleSysFraSizeConvBuf != 0 ) { // get the large frame from the conversion buffer - DoubleFrameSizeConvBufOut.GetAll ( vecsOutData, DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan ); + DoubleFrameSizeConvBufOut.GetAll ( vecsSendData, DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan ); } for ( int iB = 0; iB < iNumFrameSizeConvBlocks; iB++ ) @@ -1255,14 +1255,12 @@ void CServer::MixEncodeTransmitData ( const CVector >& vecvecsD // OPUS encoding if ( pCurOpusEncoder != nullptr ) { -// TODO find a better place than this: the setting does not change all the time -// so for speed optimization it would be better to set it only if the network -// frame size is changed -opus_custom_encoder_ctl ( pCurOpusEncoder, - OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) ); +// TODO find a better place than this: the setting does not change all the time so for speed +// optimization it would be better to set it only if the network frame size is changed +opus_custom_encoder_ctl ( pCurOpusEncoder, OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) ); iUnused = opus_custom_encode ( pCurOpusEncoder, - &vecsOutData[iB * SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan], + &vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES * iCurNumAudChan], iClientFrameSizeSamples, &vecbyCodedData[0], iCeltNumCodedBytes ); diff --git a/src/server.h b/src/server.h index 3655b9f0..f1d0b6d2 100755 --- a/src/server.h +++ b/src/server.h @@ -306,6 +306,7 @@ protected: const CVector& vecdPannings, const CVector& vecNumAudioChannels, CVector& vecdIntermProcBuf, + CVector& vecsSendData, CVector& vecbyCodedData, CChannel& Channel, CConvBuf& DoubleFrameSizeConvBufOut, @@ -315,8 +316,7 @@ protected: const int iCeltNumCodedBytes, const int iClientFrameSizeSamples, const int iCurNumAudChan, - const int iNumClients, - CVector& vecsOutData ); + const int iNumClients ); virtual void customEvent ( QEvent* pEvent );