diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index bedd53526f..454aa9f0bf 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -1339,7 +1339,8 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf // get all channels which are in use/not in use. // We use the array index of vecChanInfo if the fader is in use, // else INVALID_INDEX to specify it is not in use - // so must use "int" for the array type. + // so the array type is "int", which also keeps the comparisons below + // free of signedness warnings. int iFaderNumber[MAX_NUM_CHANNELS]; for ( size_t iChanID = 0; iChanID < MAX_NUM_CHANNELS; iChanID++ ) diff --git a/src/buffer.cpp b/src/buffer.cpp index 441b4121e4..a219204332 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -164,8 +164,8 @@ bool CNetBuf::Put ( const CVector& vecbyData, int iInSize ) return false; } - // to get the number of input blocks we assume that the number of bytes for - // the sequence number is much smaller than the number of coded audio bytes + // to get the number of input blocks we assume that the total sequence number + // overhead, iNumBlocks * iNumBytesSeqNum, is smaller than iBlockSize const int iNumBlocks = /* floor */ ( iInSize / iBlockSize ); // copy new data in internal buffer @@ -191,8 +191,8 @@ bool CNetBuf::Put ( const CVector& vecbyData, int iInSize ) } // The 1-byte sequence number wraps around at a count of 256. So, if a packet is delayed - // further than this we cannot detect it. But it does not matter since such a packet is - // more than 100 ms delayed so we have a bad network situation anyway. Therefore we + // further than half of this we cannot detect it. But it does not matter since such a packet is + // more than 170 ms delayed so we have a bad network situation anyway. Therefore we // assume that the sequence number difference between the received and local counter is // correct. The idea of the following code is that we always move our "buffer window" so // that the received packet fits into the buffer. By doing this we are robust against diff --git a/src/channel.cpp b/src/channel.cpp index 7755b7ec92..49f7b80cce 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -716,9 +716,9 @@ int CChannel::GetUploadRateKbps() { const int iAudioSizeOut = iNetwFrameSizeFact * iAudioFrameSizeSamples; - // we assume that the UDP packet which is transported via IP has an - // additional header size of ("Network Music Performance (NMP) in narrow - // band networks; Carot, Kraemer, Schuller; 2006") + // we assume the PPPoE-over-ATM DSL access path described in ("Network Music + // Performance (NMP) in narrow band networks; Carot, Kraemer, Schuller; 2006"), + // whose additional header size is // 8 (UDP) + 20 (IP without optional fields) = 28 bytes // 2 (PPP) + 6 (PPPoE) + 18 (MAC) = 26 bytes // 5 (RFC1483B) + 8 (AAL) + 10 (ATM) = 23 bytes diff --git a/src/client.cpp b/src/client.cpp index e1532c96b2..5f5f8723d7 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -482,7 +482,7 @@ void CClient::SetDoAutoSockBufSize ( const bool bValue ) // // When the first gain or pan change message is requested after an idle period (i.e. the timer is not // running), it will be sent immediately, and a timer started. The timer period is dependent on -// the current ping time to the remote server. +// the current ping time to the remote server, which only a GUI client measures (see #3874). // // If a gain or pan change message is requested while the timer is still running, the new value is not sent, // but just stored in newGain or newPan within clientChannels[iId], and the minGainOrPanId and maxGainOrPanId @@ -1000,7 +1000,7 @@ void CClient::OnControllerInMuteMyself ( bool bMute ) void CClient::OnClientIDReceived ( int iServerChanID ) { // if we have just connected to a running server, iActiveChannels will be 0 - // if iActiveChannels is not 0, the server must have been restarted on the fly + // if iActiveChannels is not 0, the server was restarted or our channel timed out // in that case, channels might have changed, so clear our list to get it afresh. if ( iActiveChannels != 0 ) { @@ -1009,7 +1009,7 @@ void CClient::OnClientIDReceived ( int iServerChanID ) } // allocate and map client-side channel 0 - int iChanID = FindClientChannel ( iServerChanID, true ); // should always return channel 0 + int iChanID = FindClientChannel ( iServerChanID, true ); // returns channel 0 for an in-range iServerChanID // for headless mode we support to mute our own signal in the personal mix // (note that the check for headless is done in the main.cpp and must not diff --git a/src/client.h b/src/client.h index b56e5c42d1..ce524da4bd 100644 --- a/src/client.h +++ b/src/client.h @@ -335,7 +335,6 @@ class CClient : public QObject void SetSettings ( CClientSettings* settings ); protected: - // Signal handler must be declared before pSettings for correct init order CSignalHandler* pSignalHandler; // Pointer to settings for MIDI and other config CClientSettings* pSettings; diff --git a/src/clientdlg.cpp b/src/clientdlg.cpp index d939b54aa2..6eb0750511 100644 --- a/src/clientdlg.cpp +++ b/src/clientdlg.cpp @@ -575,8 +575,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP, QObject::connect ( &ConnectDlg, &CConnectDlg::ReqServerListQuery, this, &CClientDlg::OnReqServerListQuery ); - // note that this connection must be a queued connection, otherwise the server list ping - // times are not accurate and the client list may not be retrieved for all servers listed + // note that this delivery must be queued, otherwise the server list ping times are not + // accurate and the client list may not be retrieved for all servers listed // (it seems the sendto() function needs to be called from different threads to fire the // packet immediately and do not collect packets before transmitting) QObject::connect ( &ConnectDlg, &CConnectDlg::CreateCLServerListPingMes, this, &CClientDlg::OnCreateCLServerListPingMes, Qt::QueuedConnection ); diff --git a/src/connectdlg.cpp b/src/connectdlg.cpp index 2af67f43f8..2c942854d5 100644 --- a/src/connectdlg.cpp +++ b/src/connectdlg.cpp @@ -164,8 +164,7 @@ CConnectDlg::CConnectDlg ( CClient* pNCliP, CClientSettings* pNSetP, const bool cbxServerAddr->installEventFilter ( this ); lvwServers->installEventFilter ( this ); - // set up list view for connected clients (note that the last column size - // must not be specified since this column takes all the remaining space) + // set up list view for connected clients #ifdef ANDROID // for Android we need larger numbers because of the default font size lvwServers->setColumnWidth ( LVC_NAME, 200 ); diff --git a/src/global.h b/src/global.h index 5414a58c41..3b075d7161 100644 --- a/src/global.h +++ b/src/global.h @@ -102,7 +102,7 @@ LED bar: lbr // 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. -// Note that the UpdateAutoSetting() function assumes a value of 128. +// Note that the IIR_WEIGTH_* filter constants in buffer.h assume values of 64 and 128. #define SYSTEM_FRAME_SIZE_SAMPLES 64 #define DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ( 2 * SYSTEM_FRAME_SIZE_SAMPLES ) diff --git a/src/main.cpp b/src/main.cpp index 10f962d4be..cc5ae25eef 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -706,8 +706,8 @@ int main ( int argc, char** argv ) #ifndef HEADLESS if ( bUseGUI ) { - // by definition, when running with the GUI we always default to registering somewhere but - // until the settings are loaded we do not know where, so we cannot be prescriptive here + // when running with the GUI, until the settings are loaded we do not know whether or + // where this server will register, so we cannot be prescriptive here if ( !strServerListFileName.isEmpty() ) { diff --git a/src/protocol.h b/src/protocol.h index 8d4125a9ab..e3959f4786 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -316,7 +316,7 @@ class CProtocol : public QObject int iOldRecID; int iOldRecCnt; - // these two objects must be sequred by a mutex + // these two objects must be secured by a mutex uint8_t iCounter; std::list SendMessQueue; diff --git a/src/server.cpp b/src/server.cpp index a49eab776c..fd42f45803 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -165,7 +165,7 @@ CServer::CServer ( const int iNewMaxNumChan, iServerFrameSizeSamples = SYSTEM_FRAME_SIZE_SAMPLES; } - // To avoid audio clitches, in the entire realtime timer audio processing + // To avoid audio glitches, in the entire realtime timer audio processing // routine including the ProcessData no memory must be allocated. Since we // do not know the required sizes for the vectors, we allocate memory for // the worst case here: @@ -662,7 +662,7 @@ void CServer::OnTimer() bool bUseMT = false; int iNumBlocks = 0; // init number of blocks for multithreading int iMTBlockSize = 0; // init block size for multithreading - bChannelIsNowDisconnected = false; // note that the flag must be a member function since QtConcurrent::run can only take 5 params + bChannelIsNowDisconnected = false; // note that the flag is a member since DecodeReceiveData sets it and the check below reads it { // Make put and get calls thread safe. diff --git a/src/socket.cpp b/src/socket.cpp index e95ab4a41f..d400a1bee8 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -192,7 +192,7 @@ void CSocket::Init ( const quint16 iNewPortNumber, UdpSocket4 = socket ( AF_INET, SOCK_DGRAM, 0 ); if ( UdpSocket4 == INVALID_SOCKET ) { - // IPv4 requested but not available, throw error (should never happen, but check anyway) + // socket creation can fail (e.g. under file descriptor exhaustion), throw error throw CGenErr ( "IPv4 requested but not available on this system.", "Network Error" ); } diff --git a/src/socket.h b/src/socket.h index 57f005b2bf..a7df73abd3 100644 --- a/src/socket.h +++ b/src/socket.h @@ -151,9 +151,9 @@ class CSocket : public QObject void ProtocolCLMessageReceived ( int iRecID, CVector vecbyMesBodyData, CHostAddress HostAdr ); }; -/* Socket which runs in a separate high priority thread --------------------- */ +/* Socket which runs in a separate thread requesting high priority ---------- */ // The receive socket should be put in a high priority thread to ensure the GUI -// does not effect the stability of the audio stream (e.g. if the GUI is on +// does not affect the stability of the audio stream (e.g. if the GUI is on // high load because of a table update, the incoming network packets must still // be put in the jitter buffer with highest priority). class CHighPrioSocket : public QObject @@ -240,7 +240,7 @@ class CHighPrioSocket : public QObject void Init() { - // Creation of the new socket thread which has to have the highest + // Creation of the new socket thread which requests the highest // possible thread priority to make sure the jitter buffer is reliably // filled with the network audio packets and does not get interrupted // by other GUI threads. The following code is based on: