fix for the "set jitter buffer message" lock up problem

This commit is contained in:
Volker Fischer 2011-05-25 21:01:45 +00:00
parent 048d8d2e15
commit 691e593e0b
7 changed files with 16 additions and 46 deletions

View File

@ -185,13 +185,13 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
// the buffer is changed), tell the server that the size has changed // the buffer is changed), tell the server that the size has changed
if ( !bIsServer && bPreserve ) if ( !bIsServer && bPreserve )
{ {
// we cannot call the "CreateJitBufMes" function directly since
// TODO this function call causes the lock up of the protocol mechanism when the // this would give us problems with different threads (e.g. the
// SetSockBufNumFrames is called directly from UpdateSocketBufferSize // audio thread) and the protocol mechanism (problem with
// -> find and fix the problem! // qRegisterMetaType(), etc.)
// reuse the request jitter buffer size signal here since it
CreateJitBufMes ( iNewNumFrames ); // does exactly what we want
emit ReqJittBufSize();
} }
return false; // -> no error return false; // -> no error
@ -612,13 +612,7 @@ const double dServerJitterMs = 0.666666; // ms
if ( iUpperHystDec == iLowerHystDec ) if ( iUpperHystDec == iLowerHystDec )
{ {
// updatet the socket buffer size with the new value // updatet the socket buffer size with the new value
SetSockBufNumFrames ( iUpperHystDec, true );
// TEST
PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec );
// TODO remove MS_SET_JIT_BUF_SIZE!
//SetSockBufNumFrames ( iUpperHystDec, true );
} }
else else
{ {
@ -630,13 +624,7 @@ PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec );
// The old result is not near the new decision, // The old result is not near the new decision,
// use per definition the upper decision. // use per definition the upper decision.
// updatet the socket buffer size with the new value // updatet the socket buffer size with the new value
SetSockBufNumFrames ( iUpperHystDec, true );
// TEST
PostWinMessage ( MS_SET_JIT_BUF_SIZE, iUpperHystDec );
// TODO remove MS_SET_JIT_BUF_SIZE!
//SetSockBufNumFrames ( iUpperHystDec, true );
} }
} }
} }

View File

@ -96,11 +96,8 @@ public:
const bool bPreserve = false ); const bool bPreserve = false );
int GetSockBufNumFrames() const { return iCurSockBufNumFrames; } int GetSockBufNumFrames() const { return iCurSockBufNumFrames; }
void UpdateSocketBufferSize ( const double dAudioBufferDurationMs,
// TEST const double dLocalStdDev );
void UpdateSocketBufferSize ( const double dAudioBufferDurationMs,
const double dLocalStdDev );
int GetUploadRateKbps(); int GetUploadRateKbps();

View File

@ -140,17 +140,7 @@ public:
void SetSockBufNumFrames ( const int iNumBlocks, void SetSockBufNumFrames ( const int iNumBlocks,
const bool bPreserve = false ) const bool bPreserve = false )
{ {
// set the new socket size (number of frames) Channel.SetSockBufNumFrames ( iNumBlocks, bPreserve );
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 );
}
} }
int GetSockBufNumFrames() { return Channel.GetSockBufNumFrames(); } int GetSockBufNumFrames() { return Channel.GetSockBufNumFrames(); }

View File

@ -229,7 +229,6 @@ typedef unsigned int _MESSAGE_IDENT;
#define MS_JIT_BUF_GET 4 #define MS_JIT_BUF_GET 4
#define MS_PACKET_RECEIVED 5 #define MS_PACKET_RECEIVED 5
#define MS_ERROR_IN_THREAD 6 #define MS_ERROR_IN_THREAD 6
#define MS_SET_JIT_BUF_SIZE 7
#define MUL_COL_LED_RED 0 #define MUL_COL_LED_RED 0
#define MUL_COL_LED_YELLOW 1 #define MUL_COL_LED_YELLOW 1

View File

@ -959,10 +959,6 @@ void CLlconClientDlg::customEvent ( QEvent* Event )
ledDelay->Reset(); ledDelay->Reset();
ledChat->Reset(); ledChat->Reset();
break; break;
case MS_SET_JIT_BUF_SIZE:
pClient->SetSockBufNumFrames ( iStatus, true );
break;
} }
// update general settings dialog, too // update general settings dialog, too

View File

@ -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 ) switch ( iMessType )
{ {

View File

@ -197,7 +197,7 @@ protected:
CVector<double>& vecdGains, CVector<double>& vecdGains,
CVector<int>& vecNumAudioChannels ); CVector<int>& vecNumAudioChannels );
virtual void customEvent ( QEvent* Event ); virtual void customEvent ( QEvent* pEvent );
// do not use the vector class since CChannel does not have appropriate // do not use the vector class since CChannel does not have appropriate
// copy constructor/operator // copy constructor/operator