fix for overall delay estimation
This commit is contained in:
parent
d398c917ff
commit
36c1bc1da4
2 changed files with 22 additions and 13 deletions
|
@ -289,7 +289,7 @@ void CClient::Init()
|
||||||
CeltDecoder = celt_decoder_create ( CeltMode );
|
CeltDecoder = celt_decoder_create ( CeltMode );
|
||||||
|
|
||||||
// 16: low/normal quality 132 kbsp (128) / 90 kbps (256)
|
// 16: low/normal quality 132 kbsp (128) / 90 kbps (256)
|
||||||
// 40: high good 204 kbps (128) / 162 kbps (256)
|
// 40: high quality 204 kbps (128) / 162 kbps (256)
|
||||||
iCeltNumCodedBytes = 16;
|
iCeltNumCodedBytes = 16;
|
||||||
|
|
||||||
vecCeltData.Init ( iCeltNumCodedBytes );
|
vecCeltData.Init ( iCeltNumCodedBytes );
|
||||||
|
|
|
@ -303,33 +303,42 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
||||||
for the average it is assumed that the buffer is half filled)
|
for the average it is assumed that the buffer is half filled)
|
||||||
- consider the jitter buffer on the server side, too
|
- consider the jitter buffer on the server side, too
|
||||||
*/
|
*/
|
||||||
|
// 2 times buffers at client and server divided by 2 (half the buffer
|
||||||
const int iTotalJitterBufferDelayMS = SYSTEM_BLOCK_DURATION_MS_FLOAT *
|
// for the delay) is simply the total socket buffer size
|
||||||
( 2 /* buffer at client and server */ * pClient->GetSockBufNumFrames() ) / 2;
|
const double dTotalJitterBufferDelayMS =
|
||||||
|
SYSTEM_BLOCK_DURATION_MS_FLOAT * pClient->GetSockBufNumFrames();
|
||||||
|
|
||||||
// we assume that we have two period sizes for the input and one for the
|
// we assume that we have two period sizes for the input and one for the
|
||||||
// output, therefore we have "3 *" instead of "2 *" (for input and output)
|
// output, therefore we have "3 *" instead of "2 *" (for input and output)
|
||||||
// the actual sound card buffer size
|
// the actual sound card buffer size
|
||||||
const int iTotalSoundCardDelayMS =
|
const double dTotalSoundCardDelayMS =
|
||||||
3 * pClient->GetSndCrdActualMonoBlSize() *
|
3 * pClient->GetSndCrdActualMonoBlSize() *
|
||||||
1000 / SYSTEM_SAMPLE_RATE;
|
1000 / SYSTEM_SAMPLE_RATE;
|
||||||
|
|
||||||
|
const double dDelayToFillNetworkPackets =
|
||||||
|
SYSTEM_BLOCK_DURATION_MS_FLOAT *
|
||||||
|
pClient->GetSndCrdPrefMonoFrameSizeFactor();
|
||||||
|
|
||||||
// TODO
|
// CELT additional delay at small frame sizes is half a frame size
|
||||||
const int iDelayToFillNetworkPackets =0;// TEST
|
const double dAdditionalAudioCodecDelay =
|
||||||
// ( pClient->GetNetwBufSizeOut() + pClient->GetAudioBlockSizeIn() ) *
|
SYSTEM_BLOCK_DURATION_MS_FLOAT / 2;
|
||||||
// 1000 / SYSTEM_SAMPLE_RATE;
|
|
||||||
|
|
||||||
const int iTotalBufferDelay = iDelayToFillNetworkPackets +
|
const double dTotalBufferDelay =
|
||||||
iTotalJitterBufferDelayMS + iTotalSoundCardDelayMS;
|
dDelayToFillNetworkPackets +
|
||||||
|
dTotalJitterBufferDelayMS +
|
||||||
|
dTotalSoundCardDelayMS +
|
||||||
|
dAdditionalAudioCodecDelay;
|
||||||
|
|
||||||
const int iOverallDelay = iTotalBufferDelay + iPingTime;
|
const int iOverallDelay =
|
||||||
|
LlconMath::round ( dTotalBufferDelay + iPingTime );
|
||||||
|
|
||||||
// apply values to GUI labels, take special care if ping time exceeds
|
// apply values to GUI labels, take special care if ping time exceeds
|
||||||
// a certain value
|
// a certain value
|
||||||
if ( iPingTime > 500 )
|
if ( iPingTime > 500 )
|
||||||
{
|
{
|
||||||
const QString sErrorText = "<font color=""red""><b>>500 ms</b></font>";
|
const QString sErrorText =
|
||||||
|
"<font color=""red""><b>>500 ms</b></font>";
|
||||||
|
|
||||||
TextLabelPingTime->setText ( sErrorText );
|
TextLabelPingTime->setText ( sErrorText );
|
||||||
TextLabelOverallDelay->setText ( sErrorText );
|
TextLabelOverallDelay->setText ( sErrorText );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue