removed Cycle Time Variance measurement since it is not required anymore

This commit is contained in:
Volker Fischer 2011-06-16 11:43:28 +00:00
parent 4325c54605
commit 0e04086d37
7 changed files with 3 additions and 145 deletions

View File

@ -46,10 +46,6 @@ CChannel::CChannel ( const bool bNIsServer ) :
// init the socket buffer
SetSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL );
// initialize cycle time variance measurement with defaults
CycleTimeVariance.Init ( SYSTEM_FRAME_SIZE_SAMPLES,
SYSTEM_SAMPLE_RATE_HZ, TIME_MOV_AV_RESPONSE_SECONDS );
// initialize channel name
ResetName();
@ -156,9 +152,6 @@ void CChannel::SetAudioStreamProperties ( const int iNewNetwFrameSize,
// init conversion buffer
ConvBuf.Init ( iNetwFrameSize * iNetwFrameSizeFact );
// reset cycle time variance measurement
CycleTimeVariance.Reset();
// tell the server that audio coding has changed
CreateNetTranspPropsMessFromCurrentSettings();
}
@ -200,24 +193,6 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
return true; // set error flag
}
void CChannel::SetDoAutoSockBufSize ( const bool bValue )
{
QMutexLocker locker ( &Mutex );
// only act on new value if it is different from the current one
if ( bDoAutoSockBufSize != bValue )
{
if ( bValue )
{
// in case auto socket buffer size was just enabled, reset statistic
CycleTimeVariance.Reset();
}
// store new setting
bDoAutoSockBufSize = bValue;
}
}
void CChannel::SetGain ( const int iChanID,
const double dNewGain )
{
@ -361,9 +336,6 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
// init conversion buffer
ConvBuf.Init ( iNetwFrameSize * iNetwFrameSizeFact );
// reset statistic
CycleTimeVariance.Reset();
}
}
@ -464,13 +436,6 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
{
eRet = PS_AUDIO_ERR;
}
// update cycle time variance measurement (this is only
// used in case auto socket buffer size is enabled)
if ( bDoAutoSockBufSize )
{
CycleTimeVariance.Update();
}
}
else
{
@ -514,9 +479,6 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
Protocol.CreateReqNetwTranspPropsMes();
}
// reset cycle time variance measurement
CycleTimeVariance.Reset();
// inform other objects that new connection was established
emit NewConnection();
}

View File

@ -105,7 +105,9 @@ public:
const int iNewNetwFrameSizeFact,
const int iNewNumAudioChannels );
void SetDoAutoSockBufSize ( const bool bValue );
void SetDoAutoSockBufSize ( const bool bValue )
{ bDoAutoSockBufSize = bValue; }
bool GetDoAutoSockBufSize() const { return bDoAutoSockBufSize; }
int GetNetwFrameSizeFact() const { return iNetwFrameSizeFact; }
@ -155,8 +157,6 @@ protected:
int iCurSockBufNumFrames;
bool bDoAutoSockBufSize;
CCycleTimeVariance CycleTimeVariance;
// network output conversion buffer
CConvBuf<uint8_t> ConvBuf;

View File

@ -594,12 +594,6 @@ void CClient::Init()
vecsAudioSndCrdMono.Init ( iMonoBlockSizeSam );
vecdAudioStereo.Init ( iStereoBlockSizeSam );
// init response time evaluation
CycleTimeVariance.Init ( SYSTEM_FRAME_SIZE_SAMPLES,
SYSTEM_SAMPLE_RATE_HZ, TIME_MOV_AV_RESPONSE_SECONDS );
CycleTimeVariance.Reset();
// init reverberation
AudioReverbL.Init ( SYSTEM_SAMPLE_RATE_HZ );
AudioReverbR.Init ( SYSTEM_SAMPLE_RATE_HZ );
@ -958,9 +952,6 @@ fflush(pFileDelay);
vecsStereoSndCrd.Reset ( 0 );
}
// update response time measurement
CycleTimeVariance.Update();
// update socket buffer size
Channel.UpdateSocketBufferSize();
}

View File

@ -320,8 +320,6 @@ protected:
// for ping measurement
CPreciseTime PreciseTime;
CCycleTimeVariance CycleTimeVariance;
public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnDetectedCLMessage ( CVector<uint8_t> vecbyData, int iNumBytes );

View File

@ -225,10 +225,6 @@ CServer::CServer ( const int iNewNumChan,
vstrChatColors[4] = "maroon";
vstrChatColors[5] = "coral";
// init moving average buffer for response time evaluation
CycleTimeVariance.Init ( SYSTEM_FRAME_SIZE_SAMPLES,
SYSTEM_SAMPLE_RATE_HZ, TIME_MOV_AV_RESPONSE_SECONDS );
// enable history graph (if requested)
if ( !strHistoryFileName.isEmpty() )
{
@ -476,9 +472,6 @@ void CServer::Start()
// start timer
HighPrecisionTimer.Start();
// init time for response time evaluation
CycleTimeVariance.Reset();
// emit start signal
emit Started();
}
@ -703,9 +696,6 @@ void CServer::OnTimer()
// does not consume any significant CPU when no client is connected.
Stop();
}
// update response time measurement
CycleTimeVariance.Update();
}
CVector<int16_t> CServer::ProcessData ( const int iCurIndex,

View File

@ -216,7 +216,6 @@ protected:
// actual working objects
CSocket Socket;
CCycleTimeVariance CycleTimeVariance;
// logging
CServerLogging Logging;

View File

@ -754,88 +754,6 @@ public:
/******************************************************************************\
* Statistics *
\******************************************************************************/
// Cycle time variance measurement ---------------------------------------------
// use for, e.g., measuring the variance of a timer
class CCycleTimeVariance
{
public:
CCycleTimeVariance() : iBlockLengthAtSystemSampleRate ( 0 ),
dIntervalTime ( 0.0 ), iNewValueBoundFactor ( 0 ) {}
void Init ( const int iNewBlockLengthAtSystemSampleRate,
const int iNewSystemSampleRateHz,
const int iHistoryLengthTimeSec,
const int iNewNewValueBoundFactor = MAX_NET_BUF_SIZE_NUM_BL )
{
// store block size and new value bound factor
iBlockLengthAtSystemSampleRate = iNewBlockLengthAtSystemSampleRate;
iNewValueBoundFactor = iNewNewValueBoundFactor;
// calculate interval time
dIntervalTime = static_cast<double> (
iBlockLengthAtSystemSampleRate ) * 1000 / iNewSystemSampleRateHz;
// calculate actual moving average length and initialize buffer
RespTimeMoAvBuf.Init ( iHistoryLengthTimeSec *
iNewSystemSampleRateHz / iNewBlockLengthAtSystemSampleRate );
}
int GetBlockLength() { return iBlockLengthAtSystemSampleRate; }
void Reset()
{
TimeLastBlock = PreciseTime.elapsed();
RespTimeMoAvBuf.Reset();
}
double Update()
{
// add time difference
const int CurTime = PreciseTime.elapsed();
// we want to calculate the standard deviation (we assume that the mean
// is correct at the block period time)
const double dCurAddVal =
static_cast<double> ( CurTime - TimeLastBlock ) - dIntervalTime;
/*
// TEST
static FILE* pFile = fopen ( "c:\\temp\\test.dat", "w" );
fprintf ( pFile, "%e %e\n", dCurAddVal, iNewValueBoundFactor * dIntervalTime );
fflush ( pFile );
// close;x=read('c:/temp/test.dat',-1,2);plot(x)
*/
// check if new value is in range (lower and upper bound)
if ( ( fabs ( dCurAddVal ) <= ( iNewValueBoundFactor * dIntervalTime ) ) )// &&
// ( fabs ( dCurAddVal ) >= dIntervalTime ) )
{
// add squared value
RespTimeMoAvBuf.Add ( dCurAddVal * dCurAddVal );
}
// store old time value
TimeLastBlock = CurTime;
return dCurAddVal;
}
// return the standard deviation, for that we need to calculate
// the sqaure root
double GetStdDev() { return sqrt ( RespTimeMoAvBuf.GetAverage() ); }
bool IsInitialized() { return RespTimeMoAvBuf.IsInitialized(); }
protected:
CPreciseTime PreciseTime;
CMovingAv<double> RespTimeMoAvBuf;
int TimeLastBlock;
int iBlockLengthAtSystemSampleRate;
double dIntervalTime;
int iNewValueBoundFactor;
};
// Error rate measurement ------------------------------------------------------
class CErrorRate
{