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
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 );
}
}
}

View File

@ -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();

View File

@ -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(); }

View File

@ -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

View File

@ -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

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 )
{

View File

@ -197,7 +197,7 @@ protected:
CVector<double>& vecdGains,
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
// copy constructor/operator