diff --git a/src/channel.cpp b/src/channel.cpp index 4469120f..7f9b4cb7 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -185,13 +185,13 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames, // the buffer is changed), tell the server that the size has changed if ( !bIsServer && bPreserve ) { - -// TODO this function call causes the lock up of the protocol mechanism when the -// SetSockBufNumFrames is called directly from UpdateSocketBufferSize -// -> find and fix the problem! - -CreateJitBufMes ( iNewNumFrames ); - + // we cannot call the "CreateJitBufMes" function directly since + // this would give us problems with different threads (e.g. the + // audio thread) and the protocol mechanism (problem with + // qRegisterMetaType(), etc.) + // reuse the request jitter buffer size signal here since it + // does exactly what we want + emit ReqJittBufSize(); } return false; // -> no error @@ -612,13 +612,7 @@ const double dServerJitterMs = 0.666666; // ms if ( iUpperHystDec == iLowerHystDec ) { // updatet the socket buffer size with the new value - -// TEST -PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec ); - -// TODO remove MS_SET_JIT_BUF_SIZE! -//SetSockBufNumFrames ( iUpperHystDec, true ); - + SetSockBufNumFrames ( iUpperHystDec, true ); } else { @@ -630,13 +624,7 @@ PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec ); // The old result is not near the new decision, // use per definition the upper decision. // updatet the socket buffer size with the new value - -// TEST -PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec ); - -// TODO remove MS_SET_JIT_BUF_SIZE! -//SetSockBufNumFrames ( iUpperHystDec, true ); - + SetSockBufNumFrames ( iUpperHystDec, true ); } } } diff --git a/src/channel.h b/src/channel.h index 8b14e8e1..e884de3c 100755 --- a/src/channel.h +++ b/src/channel.h @@ -96,11 +96,8 @@ public: const bool bPreserve = false ); int GetSockBufNumFrames() const { return iCurSockBufNumFrames; } - -// TEST -void UpdateSocketBufferSize ( const double dAudioBufferDurationMs, - const double dLocalStdDev ); - + void UpdateSocketBufferSize ( const double dAudioBufferDurationMs, + const double dLocalStdDev ); int GetUploadRateKbps(); diff --git a/src/client.h b/src/client.h index 1a79096c..ac0dbb7c 100755 --- a/src/client.h +++ b/src/client.h @@ -140,17 +140,7 @@ public: void SetSockBufNumFrames ( const int iNumBlocks, const bool bPreserve = false ) { - // set the new socket size (number of frames) - if ( !Channel.SetSockBufNumFrames ( iNumBlocks, bPreserve ) ) - { - // if setting of socket buffer size was successful, - // tell the server that the size has changed - -// TEST is done in channel now -// Channel.CreateJitBufMes ( iNumBlocks ); - - - } + Channel.SetSockBufNumFrames ( iNumBlocks, bPreserve ); } int GetSockBufNumFrames() { return Channel.GetSockBufNumFrames(); } diff --git a/src/global.h b/src/global.h index 3c5dc8b0..e93e801d 100755 --- a/src/global.h +++ b/src/global.h @@ -229,7 +229,6 @@ typedef unsigned int _MESSAGE_IDENT; #define MS_JIT_BUF_GET 4 #define MS_PACKET_RECEIVED 5 #define MS_ERROR_IN_THREAD 6 -#define MS_SET_JIT_BUF_SIZE 7 #define MUL_COL_LED_RED 0 #define MUL_COL_LED_YELLOW 1 diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 62c8508c..fa9774f9 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -959,10 +959,6 @@ void CLlconClientDlg::customEvent ( QEvent* Event ) ledDelay->Reset(); ledChat->Reset(); break; - - case MS_SET_JIT_BUF_SIZE: - pClient->SetSockBufNumFrames ( iStatus, true ); - break; } // update general settings dialog, too diff --git a/src/server.cpp b/src/server.cpp index fa2996eb..c451dfde 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -1219,11 +1219,11 @@ bool CServer::GetTimingStdDev ( double& dCurTiStdDev ) } } -void CServer::customEvent ( QEvent* Event ) +void CServer::customEvent ( QEvent* pEvent ) { - if ( Event->type() == QEvent::User + 11 ) + if ( pEvent->type() == QEvent::User + 11 ) { - const int iMessType = ( ( CLlconEvent* ) Event )->iMessType; + const int iMessType = ( (CLlconEvent*) pEvent )->iMessType; switch ( iMessType ) { diff --git a/src/server.h b/src/server.h index 55a06607..acd08f65 100755 --- a/src/server.h +++ b/src/server.h @@ -197,7 +197,7 @@ protected: CVector& vecdGains, CVector& vecNumAudioChannels ); - virtual void customEvent ( QEvent* Event ); + virtual void customEvent ( QEvent* pEvent ); // do not use the vector class since CChannel does not have appropriate // copy constructor/operator