some fixes and added some test code

This commit is contained in:
Volker Fischer 2011-06-01 18:29:07 +00:00
parent 8992f7c3fd
commit b12ee5c104
3 changed files with 13 additions and 8 deletions

View file

@ -151,10 +151,7 @@ void CChannel::SetAudioStreamProperties ( const int iNewNetwFrameSize,
// init conversion buffer
ConvBuf.Init ( iNetwFrameSize * iNetwFrameSizeFact );
// initialize and reset cycle time variance measurement
CycleTimeVariance.Init ( iNetwFrameSizeFact * SYSTEM_FRAME_SIZE_SAMPLES,
SYSTEM_SAMPLE_RATE_HZ, TIME_MOV_AV_RESPONSE_SECONDS );
// reset cycle time variance measurement
CycleTimeVariance.Reset();
// tell the server that audio coding has changed
@ -641,9 +638,9 @@ void CChannel::UpdateSocketBufferSize ( const double dLocalStdDev )
// TEST
//if (bIsServer) {
static FILE* pFile = fopen ( "c:\\temp\\test.dat", "w" );
fprintf ( pFile, "%e %e %e %e\n", CycleTimeVariance.GetStdDev(), dLocalStdDev, dAudioBufferDurationMs, dEstCurBufSet );
fprintf ( pFile, "%e %e %e\n", CycleTimeVariance.GetStdDev(), dLocalStdDev, dEstCurBufSet );
fflush ( pFile );
// close;x=read('c:/temp/test.dat',-1,4);plot(x)
// close;x=read('c:/temp/test.dat',-1,3);plot(x)
//}
*/

View file

@ -595,7 +595,7 @@ void CClient::Init()
vecdAudioStereo.Init ( iStereoBlockSizeSam );
// init response time evaluation
CycleTimeVariance.Init ( iMonoBlockSizeSam,
CycleTimeVariance.Init ( SYSTEM_FRAME_SIZE_SAMPLES,
SYSTEM_SAMPLE_RATE_HZ, TIME_MOV_AV_RESPONSE_SECONDS );
CycleTimeVariance.Reset();

View file

@ -727,7 +727,7 @@ public:
void Init ( const int iNewBlockLengthAtSystemSampleRate,
const int iNewSystemSampleRateHz,
const int iHistoryLengthTimeSec,
const int iNewNewValueBoundFactor = 10 )
const int iNewNewValueBoundFactor = MAX_NET_BUF_SIZE_NUM_BL )
{
// store block size and new value bound factor
iBlockLengthAtSystemSampleRate = iNewBlockLengthAtSystemSampleRate;
@ -760,6 +760,14 @@ public:
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)
*/
if ( iNewValueBoundFactor > 0 )
{
// check if new value is in range