Skip to content

Commit dbd34cd

Browse files
authored
Merge pull request #2600 from pgScorpio/todo-comments
Code style change: Replace clang-format off/on with TODO/TEST comments.
2 parents 154f18a + d0d6f16 commit dbd34cd

File tree

16 files changed

+192
-184
lines changed

16 files changed

+192
-184
lines changed

src/buffer.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -639,23 +639,23 @@ void CNetBufWithStats::UpdateAutoSetting()
639639
// apply non-linear IIR filter
640640
MathUtils().UpDownIIR1 ( dCurIIRFilterResult, static_cast<double> ( iCurDecision ), dWeightUp, dWeightDown );
641641

642-
// clang-format off
643-
/*
644-
// TEST store important detection parameters in file for debugging
645-
static FILE* pFile = fopen ( "test.dat", "w" );
646-
static int icnt = 0;
647-
if ( icnt == 50 )
648-
{
649-
fprintf ( pFile, "%d %e\n", iCurDecision, dCurIIRFilterResult );
650-
fflush ( pFile );
651-
icnt = 0;
652-
}
653-
else
654-
{
655-
icnt++;
656-
}
657-
*/
658-
// clang-format on
642+
//### TEST: BEGIN ###//
643+
// TEST store important detection parameters in file for debugging
644+
/*
645+
static FILE* pFile = fopen ( "test.dat", "w" );
646+
static int icnt = 0;
647+
if ( icnt == 50 )
648+
{
649+
fprintf ( pFile, "%d %e\n", iCurDecision, dCurIIRFilterResult );
650+
fflush ( pFile );
651+
icnt = 0;
652+
}
653+
else
654+
{
655+
icnt++;
656+
}
657+
*/
658+
//### TEST: END ###//
659659

660660
// apply a hysteresis
661661
iCurAutoBufferSizeSetting = MathUtils().DecideWithHysteresis ( dCurIIRFilterResult, iCurDecidedResult, dHysteresisValue );

src/channel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ CChannel::CChannel ( const bool bNIsServer ) :
5959

6060
// Connections -------------------------------------------------------------
6161

62-
// clang-format off
63-
// TODO if we later do not fire vectors in the emits, we can remove this again
64-
qRegisterMetaType<CVector<uint8_t> > ( "CVector<uint8_t>" );
65-
qRegisterMetaType<CHostAddress> ( "CHostAddress" );
66-
// clang-format on
62+
//### TODO: BEGIN ###//
63+
// if we later do not fire vectors in the emits, we can remove this again
64+
qRegisterMetaType<CVector<uint8_t>> ( "CVector<uint8_t>" );
65+
qRegisterMetaType<CHostAddress> ( "CHostAddress" );
66+
//### TODO: END ###//
6767

6868
QObject::connect ( &Protocol, &CProtocol::MessReadyForSending, this, &CChannel::OnSendProtMessage );
6969

src/channel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ class CChannel : public QObject
156156
void CreateChatTextMes ( const QString& strChatText ) { Protocol.CreateChatTextMes ( strChatText ); }
157157
void CreateLicReqMes ( const ELicenceType eLicenceType ) { Protocol.CreateLicenceRequiredMes ( eLicenceType ); }
158158

159-
// clang-format off
160-
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
161-
void CreateReqChannelLevelListMes() { Protocol.CreateReqChannelLevelListMes(); }
162-
// clang-format on
159+
//### TODO: BEGIN ###//
160+
// needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
161+
void CreateReqChannelLevelListMes() { Protocol.CreateReqChannelLevelListMes(); }
162+
//### TODO: END ###//
163163

164164
void CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo ) { Protocol.CreateConClientListMes ( vecChanInfo ); }
165165

src/client.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ void CClient::OnNewConnection()
273273
Channel.CreateReqConnClientsList();
274274
CreateServerJitterBufferMessage();
275275

276-
// clang-format off
277-
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
278-
Channel.CreateReqChannelLevelListMes();
279-
// clang-format on
276+
//### TODO: BEGIN ###//
277+
// needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
278+
Channel.CreateReqChannelLevelListMes();
279+
//### TODO: END ###//
280280
}
281281

282282
void CClient::CreateServerJitterBufferMessage()
@@ -1088,13 +1088,13 @@ void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
10881088
// process audio data
10891089
pMyClientObj->ProcessSndCrdAudioData ( psData );
10901090

1091-
// clang-format off
1092-
/*
1093-
// TEST do a soundcard jitter measurement
1094-
static CTimingMeas JitterMeas ( 1000, "test2.dat" );
1095-
JitterMeas.Measure();
1096-
*/
1097-
// clang-format on
1091+
//### TEST: BEGIN ###//
1092+
// do a soundcard jitter measurement
1093+
/*
1094+
static CTimingMeas JitterMeas ( 1000, "test2.dat" );
1095+
JitterMeas.Measure();
1096+
*/
1097+
//### TEST: END ###//
10981098
}
10991099

11001100
void CClient::ProcessSndCrdAudioData ( CVector<int16_t>& vecsStereoSndCrd )

src/clientdlg.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,11 +1266,11 @@ void CClientDlg::Disconnect()
12661266
TimerDetectFeedback.stop();
12671267
bDetectFeedback = false;
12681268

1269-
// clang-format off
1270-
// TODO is this still required???
1271-
// immediately update status bar
1272-
OnTimerStatus();
1273-
// clang-format on
1269+
//### TODO: BEGIN ###//
1270+
// is this still required???
1271+
// immediately update status bar
1272+
OnTimerStatus();
1273+
//### TODO: END ###//
12741274

12751275
// reset LEDs
12761276
ledBuffers->Reset();

src/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,10 @@ int main ( int argc, char** argv )
812812
Q_INIT_RESOURCE ( resources );
813813

814814
#ifndef SERVER_ONLY
815-
// clang-format off
816-
// TEST -> activate the following line to activate the test bench,
817-
//CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER );
818-
// clang-format on
815+
//### TEST: BEGIN ###//
816+
// activate the following line to activate the test bench,
817+
// CTestbench Testbench ( "127.0.0.1", DEFAULT_PORT_NUMBER );
818+
//### TEST: END ###//
819819
#endif
820820

821821
CRpcServer* pRpcServer = nullptr;

src/protocol.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -619,12 +619,10 @@ void CProtocol::CreateAndImmSendConLessMessage ( const int iID, const CVector<ui
619619

620620
void CProtocol::ParseMessageBody ( const CVector<uint8_t>& vecbyMesBodyData, const int iRecCounter, const int iRecID )
621621
{
622-
// clang-format off
623-
/*
624-
// TEST channel implementation: randomly delete protocol messages (50 % loss)
625-
if ( rand() < ( RAND_MAX / 2 ) ) return false;
626-
*/
627-
// clang-format on
622+
//### TEST: BEGIN ###//
623+
// channel implementation: randomly delete protocol messages (50 % loss)
624+
// if ( rand() < ( RAND_MAX / 2 ) ) return false;
625+
//### TEST: END ###//
628626

629627
// In case we received a message and returned an answer but our answer
630628
// did not make it to the receiver, he will resend his message. We check
@@ -842,12 +840,11 @@ if ( rand() < ( RAND_MAX / 2 ) ) return false;
842840

843841
void CProtocol::ParseConnectionLessMessageBody ( const CVector<uint8_t>& vecbyMesBodyData, const int iRecID, const CHostAddress& InetAddr )
844842
{
845-
// clang-format off
846-
/*
847-
// TEST channel implementation: randomly delete protocol messages (50 % loss)
848-
if ( rand() < ( RAND_MAX / 2 ) ) return false;
849-
*/
850-
// clang-format on
843+
//### TEST: BEGIN ###//
844+
// Test channel implementation: randomly delete protocol messages (50 % loss)
845+
846+
// if ( rand() < ( RAND_MAX / 2 ) ) return false;
847+
//### TEST: END ###//
851848

852849
// check which type of message we received and do action
853850
switch ( iRecID )
@@ -2646,12 +2643,11 @@ bool CProtocol::ParseMessageFrame ( const CVector<uint8_t>& vecbyData,
26462643

26472644
// Extract actual data -----------------------------------------------------
26482645

2649-
// clang-format off
2650-
// TODO this memory allocation is done in the real time thread but should be
2651-
// done in the low priority protocol management thread
2652-
// clang-format on
2653-
2646+
//### TODO: BEGIN ###//
2647+
// this memory allocation is done in the real time thread but should be
2648+
// done in the low priority protocol management thread
26542649
vecbyMesBodyData.Init ( iLenBy );
2650+
//### TODO: END ###//
26552651

26562652
iCurPos = MESS_HEADER_LENGTH_BYTE; // start from beginning of data
26572653

src/protocol.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ class CProtocol : public QObject
127127
void CreateLicenceRequiredMes ( const ELicenceType eLicenceType );
128128
void CreateOpusSupportedMes();
129129

130-
// clang-format off
131-
// TODO needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
132-
void CreateReqChannelLevelListMes();
133-
// clang-format on
130+
//### TODO: BEGIN ###//
131+
// needed for compatibility to old servers >= 3.4.6 and <= 3.5.12
132+
void CreateReqChannelLevelListMes();
133+
//### TODO: END ###//
134134

135135
void CreateVersionAndOSMes();
136136
void CreateRecorderStateMes ( const ERecorderState eRecorderState );

src/server.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,12 @@ void CHighPrecisionTimer::run()
182182
{
183183
// call processing routine by fireing signal
184184

185-
// clang-format off
186-
// TODO by emit a signal we leave the high priority thread -> maybe use some
187-
// other connection type to have something like a true callback, e.g.
188-
// "Qt::DirectConnection" -> Can this work?
189-
// clang-format on
190-
185+
//### TODO: BEGIN ###//
186+
// by emit a signal we leave the high priority thread -> maybe use some
187+
// other connection type to have something like a true callback, e.g.
188+
// "Qt::DirectConnection" -> Can this work?
191189
emit timeout();
190+
//### TODO: END ###//
192191

193192
// now wait until the next buffer shall be processed (we
194193
// use the "increment method" to make sure we do not introduce
@@ -756,11 +755,11 @@ void CServer::Stop()
756755

757756
void CServer::OnTimer()
758757
{
759-
// clang-format off
760-
/*
761-
static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure(); // TEST do a timer jitter measurement
762-
*/
763-
// clang-format on
758+
//### TEST: BEGIN ###//
759+
// uncomment next line to do a timer Jitter measurement
760+
// static CTimingMeas JitterMeas ( 1000, "test2.dat" ); JitterMeas.Measure();
761+
//### TEST: END ###//
762+
764763
// Get data from all connected clients -------------------------------------
765764
// some inits
766765
int iNumClients = 0; // init connected client counter
@@ -1344,11 +1343,12 @@ void CServer::MixEncodeTransmitData ( const int iChanCnt, const int iNumClients
13441343
// OPUS encoding
13451344
if ( pCurOpusEncoder != nullptr )
13461345
{
1347-
// clang-format off
1348-
// TODO find a better place than this: the setting does not change all the time so for speed
1349-
// optimization it would be better to set it only if the network frame size is changed
1350-
opus_custom_encoder_ctl ( pCurOpusEncoder, OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) );
1351-
// clang-format on
1346+
//### TODO: BEGIN ###//
1347+
// find a better place than this: the setting does not change all the time so for speed
1348+
// optimization it would be better to set it only if the network frame size is changed
1349+
opus_custom_encoder_ctl ( pCurOpusEncoder,
1350+
OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iClientFrameSizeSamples ) ) );
1351+
//### TODO: END ###//
13521352

13531353
for ( int iB = 0; iB < vecNumFrameSizeConvBlocks[iChanCnt]; iB++ )
13541354
{

src/serverdlg.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,11 @@ CServerDlg::CServerDlg ( CServer* pNServP, CServerSettings* pNSetP, const bool b
273273
lvwClients->setColumnWidth ( 3, 50 ); // Channels
274274
lvwClients->clear();
275275

276-
// clang-format off
277-
// TEST workaround for resize problem of window after iconize in task bar
278-
lvwClients->setMinimumWidth ( 170 + 130 + 60 + 205 );
279-
lvwClients->setMinimumHeight ( 140 );
280-
// clang-format on
276+
//### TODO: BEGIN ###//
277+
// workaround for resize problem of window after iconize in task bar
278+
lvwClients->setMinimumWidth ( 170 + 130 + 60 + 205 );
279+
lvwClients->setMinimumHeight ( 140 );
280+
//### TODO: END ###//
281281

282282
// insert items in reverse order because in Windows all of them are
283283
// always visible -> put first item on the top

0 commit comments

Comments
 (0)