rename SYSTEM_FRAME_SIZE_SAMPLES_SMALL to SYSTEM_FRAME_SIZE_SAMPLES

This commit is contained in:
Volker Fischer 2020-04-15 15:29:43 +02:00
parent f51dd662c4
commit b335321950
6 changed files with 93 additions and 93 deletions

View file

@ -166,7 +166,7 @@ void CChannel::SetAudioStreamProperties ( const EAudComprType eNewAudComprType,
} }
else else
{ {
iAudioFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iAudioFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
} }
MutexSocketBuf.lock(); MutexSocketBuf.lock();
@ -387,7 +387,7 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
else else
{ {
iFadeInCntMax = FADE_IN_NUM_FRAMES / iNetwFrameSizeFact; iFadeInCntMax = FADE_IN_NUM_FRAMES / iNetwFrameSizeFact;
iAudioFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iAudioFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
} }
MutexSocketBuf.lock(); MutexSocketBuf.lock();

View file

@ -83,7 +83,7 @@ CClient::CClient ( const quint16 iPortNumber,
&iOpusError ); &iOpusError );
Opus64Mode = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ, Opus64Mode = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ,
SYSTEM_FRAME_SIZE_SAMPLES_SMALL, SYSTEM_FRAME_SIZE_SAMPLES,
&iOpusError ); &iOpusError );
// init audio encoders and decoders // init audio encoders and decoders
@ -669,16 +669,16 @@ void CClient::Stop()
void CClient::Init() void CClient::Init()
{ {
// check if possible frame size factors are supported // check if possible frame size factors are supported
const int iFraSizePreffered = SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_PREFERRED; const int iFraSizePreffered = SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED;
const int iFraSizeDefault = SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_DEFAULT; const int iFraSizeDefault = SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT;
const int iFraSizeSafe = SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_SAFE; const int iFraSizeSafe = SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE;
bFraSiFactPrefSupported = ( Sound.Init ( iFraSizePreffered ) == iFraSizePreffered ); bFraSiFactPrefSupported = ( Sound.Init ( iFraSizePreffered ) == iFraSizePreffered );
bFraSiFactDefSupported = ( Sound.Init ( iFraSizeDefault ) == iFraSizeDefault ); bFraSiFactDefSupported = ( Sound.Init ( iFraSizeDefault ) == iFraSizeDefault );
bFraSiFactSafeSupported = ( Sound.Init ( iFraSizeSafe ) == iFraSizeSafe ); bFraSiFactSafeSupported = ( Sound.Init ( iFraSizeSafe ) == iFraSizeSafe );
// translate block size index in actual block size // translate block size index in actual block size
const int iPrefMonoFrameSize = iSndCrdPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES_SMALL; const int iPrefMonoFrameSize = iSndCrdPrefFrameSizeFactor * SYSTEM_FRAME_SIZE_SAMPLES;
// get actual sound card buffer size using preferred size // get actual sound card buffer size using preferred size
iMonoBlockSizeSam = Sound.Init ( iPrefMonoFrameSize ); iMonoBlockSizeSam = Sound.Init ( iPrefMonoFrameSize );
@ -686,12 +686,12 @@ void CClient::Init()
// Calculate the current sound card frame size factor. In case // Calculate the current sound card frame size factor. In case
// the current mono block size is not a multiple of the system // the current mono block size is not a multiple of the system
// frame size, we have to use a sound card conversion buffer. // frame size, we have to use a sound card conversion buffer.
if ( ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_PREFERRED ) ) || if ( ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED ) ) ||
( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_DEFAULT ) ) || ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT ) ) ||
( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_SAFE ) ) ) ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE ) ) )
{ {
// regular case: one of our predefined buffer sizes is available // regular case: one of our predefined buffer sizes is available
iSndCrdFrameSizeFactor = iMonoBlockSizeSam / SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iSndCrdFrameSizeFactor = iMonoBlockSizeSam / SYSTEM_FRAME_SIZE_SAMPLES;
// no sound card conversion buffer required // no sound card conversion buffer required
bSndCrdConversionBufferRequired = false; bSndCrdConversionBufferRequired = false;
@ -715,7 +715,7 @@ void CClient::Init()
{ {
if ( iSndCardMonoBlockSizeSamConvBuff < DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ) if ( iSndCardMonoBlockSizeSamConvBuff < DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES )
{ {
iMonoBlockSizeSam = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iMonoBlockSizeSam = SYSTEM_FRAME_SIZE_SAMPLES;
eAudioCompressionType = CT_OPUS64; eAudioCompressionType = CT_OPUS64;
} }
else else
@ -773,7 +773,7 @@ void CClient::Init()
} }
else /* CT_OPUS64 */ else /* CT_OPUS64 */
{ {
iOPUSFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iOPUSFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
if ( eAudioChannelConf == CC_MONO ) if ( eAudioChannelConf == CC_MONO )
{ {

View file

@ -347,14 +347,14 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
// set text for sound card buffer delay radio buttons // set text for sound card buffer delay radio buttons
rbtBufferDelayPreferred->setText ( GenSndCrdBufferDelayString ( rbtBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES_SMALL, FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES,
", preferred" ) ); ", preferred" ) );
rbtBufferDelayDefault->setText ( GenSndCrdBufferDelayString ( rbtBufferDelayDefault->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES_SMALL ) ); FRAME_SIZE_FACTOR_DEFAULT * SYSTEM_FRAME_SIZE_SAMPLES ) );
rbtBufferDelaySafe->setText ( GenSndCrdBufferDelayString ( rbtBufferDelaySafe->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES_SMALL ) ); FRAME_SIZE_FACTOR_SAFE * SYSTEM_FRAME_SIZE_SAMPLES ) );
// sound card buffer delay inits // sound card buffer delay inits
SndCrdBufferDelayButtonGroup.addButton ( rbtBufferDelayPreferred ); SndCrdBufferDelayButtonGroup.addButton ( rbtBufferDelayPreferred );
@ -472,9 +472,9 @@ void CClientSettingsDlg::UpdateSoundCardFrame()
const int iCurActualBufSize = pClient->GetSndCrdActualMonoBlSize(); const int iCurActualBufSize = pClient->GetSndCrdActualMonoBlSize();
// check which predefined size is used (it is possible that none is used) // check which predefined size is used (it is possible that none is used)
const bool bPreferredChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_PREFERRED ); const bool bPreferredChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED );
const bool bDefaultChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_DEFAULT ); const bool bDefaultChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT );
const bool bSafeChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES_SMALL * FRAME_SIZE_FACTOR_SAFE ); const bool bSafeChecked = ( iCurActualBufSize == SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE );
// Set radio buttons according to current value (To make it possible // Set radio buttons according to current value (To make it possible
// to have all radio buttons unchecked, we have to disable the // to have all radio buttons unchecked, we have to disable the

View file

@ -98,8 +98,8 @@ LED bar: lbr
// System block size, this is the block size on which the audio coder works. // System block size, this is the block size on which the audio coder works.
// All other block sizes must be a multiple of this size. // All other block sizes must be a multiple of this size.
// Note that the UpdateAutoSetting() function assumes a value of 128. // Note that the UpdateAutoSetting() function assumes a value of 128.
#define SYSTEM_FRAME_SIZE_SAMPLES_SMALL 64 // TODO this is temporary and shall be replaced by SYSTEM_FRAME_SIZE_SAMPLES later on #define SYSTEM_FRAME_SIZE_SAMPLES 64
#define DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ( 2 * SYSTEM_FRAME_SIZE_SAMPLES_SMALL ) #define DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ( 2 * SYSTEM_FRAME_SIZE_SAMPLES )
// default server address // default server address
#define DEFAULT_SERVER_ADDRESS "jamulus.fischvolk.de" #define DEFAULT_SERVER_ADDRESS "jamulus.fischvolk.de"

View file

@ -118,7 +118,7 @@ int main ( int argc, char** argv )
"--fastupdate" ) ) "--fastupdate" ) )
{ {
bUseDoubleSystemFrameSize = false; // 64 samples frame size bUseDoubleSystemFrameSize = false; // 64 samples frame size
tsConsole << "- using " << SYSTEM_FRAME_SIZE_SAMPLES_SMALL << " samples frame size mode" << endl; tsConsole << "- using " << SYSTEM_FRAME_SIZE_SAMPLES << " samples frame size mode" << endl;
continue; continue;
} }

View file

@ -32,7 +32,7 @@ CHighPrecisionTimer::CHighPrecisionTimer ( const bool bNewUseDoubleSystemFrameSi
{ {
// add some error checking, the high precision timer implementation only // add some error checking, the high precision timer implementation only
// supports 64 and 128 samples frame size at 48 kHz sampling rate // supports 64 and 128 samples frame size at 48 kHz sampling rate
#if ( SYSTEM_FRAME_SIZE_SAMPLES_SMALL != 64 ) && ( DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES != 128 ) #if ( SYSTEM_FRAME_SIZE_SAMPLES != 64 ) && ( DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES != 128 )
# error "Only system frame size of 64 and 128 samples is supported by this module" # error "Only system frame size of 64 and 128 samples is supported by this module"
#endif #endif
#if ( SYSTEM_SAMPLE_RATE_HZ != 48000 ) #if ( SYSTEM_SAMPLE_RATE_HZ != 48000 )
@ -127,7 +127,7 @@ CHighPrecisionTimer::CHighPrecisionTimer ( const bool bUseDoubleSystemFrameSize
} }
else else
{ {
iNsDelay = ( (uint64_t) SYSTEM_FRAME_SIZE_SAMPLES_SMALL * 1000000000 ) / iNsDelay = ( (uint64_t) SYSTEM_FRAME_SIZE_SAMPLES * 1000000000 ) /
(uint64_t) SYSTEM_SAMPLE_RATE_HZ; // in ns (uint64_t) SYSTEM_SAMPLE_RATE_HZ; // in ns
} }
@ -267,7 +267,7 @@ CServer::CServer ( const int iNewMaxNumChan,
&iOpusError ); &iOpusError );
Opus64Mode[i] = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ, Opus64Mode[i] = opus_custom_mode_create ( SYSTEM_SAMPLE_RATE_HZ,
SYSTEM_FRAME_SIZE_SAMPLES_SMALL, SYSTEM_FRAME_SIZE_SAMPLES,
&iOpusError ); &iOpusError );
// init audio encoders and decoders // init audio encoders and decoders
@ -320,7 +320,7 @@ CServer::CServer ( const int iNewMaxNumChan,
} }
else else
{ {
iServerFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iServerFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
} }
@ -953,7 +953,7 @@ JitterMeas.Measure();
} }
else if ( vecAudioComprType[i] == CT_OPUS64 ) else if ( vecAudioComprType[i] == CT_OPUS64 )
{ {
iClientFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iClientFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
if ( vecNumAudioChannels[i] == 1 ) if ( vecNumAudioChannels[i] == 1 )
{ {
@ -988,7 +988,7 @@ JitterMeas.Measure();
// is false and the Get() function is not called at all. Therefore if the buffer is not needed // 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. // we do not spend any time in the function but go directly inside the if condition.
if ( ( vecUseDoubleSysFraSizeConvBuf[i] == 0 ) || if ( ( vecUseDoubleSysFraSizeConvBuf[i] == 0 ) ||
!DoubleFrameSizeConvBufIn[iCurChanID].Get ( vecvecsData[i], SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i] ) ) !DoubleFrameSizeConvBufIn[iCurChanID].Get ( vecvecsData[i], SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i] ) )
{ {
// get current number of OPUS coded bytes // get current number of OPUS coded bytes
const int iCeltNumCodedBytes = vecChannels[iCurChanID].GetNetwFrameSize(); const int iCeltNumCodedBytes = vecChannels[iCurChanID].GetNetwFrameSize();
@ -1028,7 +1028,7 @@ JitterMeas.Measure();
opus_custom_decode ( CurOpusDecoder, opus_custom_decode ( CurOpusDecoder,
pCurCodedData, pCurCodedData,
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][iB * SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i]], &vecvecsData[i][iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]],
iClientFrameSizeSamples ); iClientFrameSizeSamples );
} }
} }
@ -1038,7 +1038,7 @@ JitterMeas.Measure();
if ( vecUseDoubleSysFraSizeConvBuf[i] != 0 ) if ( vecUseDoubleSysFraSizeConvBuf[i] != 0 )
{ {
DoubleFrameSizeConvBufIn[iCurChanID].PutAll ( vecvecsData[i] ); DoubleFrameSizeConvBufIn[iCurChanID].PutAll ( vecvecsData[i] );
DoubleFrameSizeConvBufIn[iCurChanID].Get ( vecvecsData[i], SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i] ); DoubleFrameSizeConvBufIn[iCurChanID].Get ( vecvecsData[i], SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i] );
} }
} }
} }
@ -1131,7 +1131,7 @@ JitterMeas.Measure();
} }
else if ( vecAudioComprType[i] == CT_OPUS64 ) else if ( vecAudioComprType[i] == CT_OPUS64 )
{ {
iClientFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES_SMALL; iClientFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES;
if ( vecNumAudioChannels[i] == 1 ) if ( vecNumAudioChannels[i] == 1 )
{ {
@ -1153,7 +1153,7 @@ JitterMeas.Measure();
// is false and the Get() function is not called at all. Therefore if the buffer is not needed // 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. // we do not spend any time in the function but go directly inside the if condition.
if ( ( vecUseDoubleSysFraSizeConvBuf[i] == 0 ) || if ( ( vecUseDoubleSysFraSizeConvBuf[i] == 0 ) ||
DoubleFrameSizeConvBufOut[iCurChanID].Put ( vecsSendData, SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i] ) ) DoubleFrameSizeConvBufOut[iCurChanID].Put ( vecsSendData, SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i] ) )
{ {
if ( vecUseDoubleSysFraSizeConvBuf[i] != 0 ) if ( vecUseDoubleSysFraSizeConvBuf[i] != 0 )
{ {
@ -1173,7 +1173,7 @@ opus_custom_encoder_ctl ( CurOpusEncoder,
OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) ); OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) );
opus_custom_encode ( CurOpusEncoder, opus_custom_encode ( CurOpusEncoder,
&vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i]], &vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[i]],
iClientFrameSizeSamples, iClientFrameSizeSamples,
&vecbyCodedData[0], &vecbyCodedData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );