some small fixes

This commit is contained in:
Volker Fischer 2020-06-07 13:08:06 +02:00
parent efc24ffdbe
commit 93ec45d9cc

View File

@ -753,18 +753,9 @@ void CServer::Stop()
void CServer::OnTimer() void CServer::OnTimer()
{ {
int i, j, iUnused;
int iClientFrameSizeSamples = 0; // initialize to avoid a compiler warning
OpusCustomDecoder* CurOpusDecoder;
OpusCustomEncoder* CurOpusEncoder;
unsigned char* pCurCodedData;
/* /*
// TEST do a timer jitter measurement static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure(); // TEST do a timer jitter measurement
static CTimingMeas JitterMeas ( 1000, "test2.dat" );
JitterMeas.Measure();
*/ */
// Get data from all connected clients ------------------------------------- // Get data from all connected clients -------------------------------------
// some inits // some inits
int iNumClients = 0; // init connected client counter int iNumClients = 0; // init connected client counter
@ -777,7 +768,7 @@ JitterMeas.Measure();
Mutex.lock(); Mutex.lock();
{ {
// first, get number and IDs of connected channels // first, get number and IDs of connected channels
for ( i = 0; i < iMaxNumChannels; i++ ) for ( int i = 0; i < iMaxNumChannels; i++ )
{ {
if ( vecChannels[i].IsConnected() ) if ( vecChannels[i].IsConnected() )
{ {
@ -791,8 +782,12 @@ JitterMeas.Measure();
} }
// process connected channels // process connected channels
for ( i = 0; i < iNumClients; i++ ) for ( int i = 0; i < iNumClients; i++ )
{ {
int iClientFrameSizeSamples = 0; // initialize to avoid a compiler warning
OpusCustomDecoder* CurOpusDecoder;
unsigned char* pCurCodedData;
// get actual ID of current channel // get actual ID of current channel
const int iCurChanID = vecChanIDsCurConChan[i]; const int iCurChanID = vecChanIDsCurConChan[i];
@ -852,7 +847,7 @@ JitterMeas.Measure();
} }
// get gains of all connected channels // get gains of all connected channels
for ( j = 0; j < iNumClients; j++ ) for ( int j = 0; j < iNumClients; j++ )
{ {
// The second index of "vecvecdGains" does not represent // The second index of "vecvecdGains" does not represent
// the channel ID! Therefore we have to use // the channel ID! Therefore we have to use
@ -916,11 +911,11 @@ JitterMeas.Measure();
// OPUS decode received data stream // OPUS decode received data stream
if ( CurOpusDecoder != nullptr ) if ( CurOpusDecoder != nullptr )
{ {
iUnused = opus_custom_decode ( CurOpusDecoder, Q_UNUSED ( opus_custom_decode ( CurOpusDecoder,
pCurCodedData, pCurCodedData,
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]], &vecvecsData[i][iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]],
iClientFrameSizeSamples ); iClientFrameSizeSamples ) );
} }
} }
@ -960,6 +955,9 @@ JitterMeas.Measure();
for ( int i = 0; i < iNumClients; i++ ) for ( int i = 0; i < iNumClients; i++ )
{ {
int iClientFrameSizeSamples = 0; // initialize to avoid a compiler warning
OpusCustomEncoder* CurOpusEncoder;
// get actual ID of current channel // get actual ID of current channel
const int iCurChanID = vecChanIDsCurConChan[i]; const int iCurChanID = vecChanIDsCurConChan[i];
@ -1046,11 +1044,11 @@ JitterMeas.Measure();
opus_custom_encoder_ctl ( CurOpusEncoder, opus_custom_encoder_ctl ( CurOpusEncoder,
OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) ); OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) );
iUnused = opus_custom_encode ( CurOpusEncoder, Q_UNUSED ( opus_custom_encode ( CurOpusEncoder,
&vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]], &vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]],
iClientFrameSizeSamples, iClientFrameSizeSamples,
&vecbyCodedData[0], &vecbyCodedData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes ) );
} }
// send separate mix to current clients // send separate mix to current clients
@ -1078,8 +1076,6 @@ opus_custom_encoder_ctl ( CurOpusEncoder,
// does not consume any significant CPU when no client is connected. // does not consume any significant CPU when no client is connected.
Stop(); Stop();
} }
Q_UNUSED ( iUnused )
} }
/// @brief Mix all audio data from all clients together. /// @brief Mix all audio data from all clients together.