bug fix with overall delay calculation if sound card conversion buffer is used

This commit is contained in:
Volker Fischer 2010-02-07 12:15:36 +00:00
parent 9f3d07ca67
commit 1c76d2e8fe
4 changed files with 30 additions and 7 deletions

View file

@ -1,5 +1,10 @@
3.0.4
- all available ASIO sample formats supported
- sound card frame size support for frame sizes other than 128, 256 and 512
samples
- improvement of network buffer (jitter buffer) in case of small buffer sizes
@ -53,7 +58,7 @@
- bug fix: buzzing occurred when audio stream was interrupted (e.g. in case
of network trouble)
3.0.0
- introduced new audio codec "CELT", not compatible to old versions

View file

@ -355,7 +355,6 @@ void CClient::Init()
iSndCrdFrameSizeFactor = iMonoBlockSizeSam / SYSTEM_FRAME_SIZE_SAMPLES;
// no sound card conversion buffer required
iSndCardMonoBlockSizeSamConvBuff = 0; // this is important!
bSndCrdConversionBufferRequired = false;
}
else
@ -640,7 +639,8 @@ void CClient::UpdateSocketBufferSize()
// calculate current buffer setting
const double dAudioBufferDurationMs =
( iMonoBlockSizeSam + iSndCardMonoBlockSizeSamConvBuff ) *
( GetSndCrdActualMonoBlSize() +
GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
1000 / SYSTEM_SAMPLE_RATE;
// jitter introduced in the server by the timer implementation

View file

@ -142,13 +142,27 @@ public:
// sound card conversion buffer is used or not
if ( bSndCrdConversionBufferRequired )
{
return iSndCardMonoBlockSizeSamConvBuff + iMonoBlockSizeSam;
return iSndCardMonoBlockSizeSamConvBuff;
}
else
{
return iMonoBlockSizeSam;
}
}
int GetSystemMonoBlSize() { return iMonoBlockSizeSam; }
int GetSndCrdConvBufAdditionalDelayMonoBlSize()
{
if ( bSndCrdConversionBufferRequired )
{
// by introducing the conversion buffer we also introduce additional
// delay which equals the "internal" mono buffer size
return iMonoBlockSizeSam;
}
else
{
return 0;
}
}
bool GetFraSiFactPrefSupported() { return bFraSiFactPrefSupported; }
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }

View file

@ -508,14 +508,18 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
// 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)
// the actual sound card buffer size
// the actual sound card buffer size, also consider delay introduced by
// sound card conversion buffer by using
// "GetSndCrdConvBufAdditionalDelayMonoBlSize"
const double dTotalSoundCardDelayMS =
3 * pClient->GetSndCrdActualMonoBlSize() *
( 3 * pClient->GetSndCrdActualMonoBlSize() +
pClient->GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
1000 / SYSTEM_SAMPLE_RATE;
// network packets are of the same size as the audio packets per definition
// if no sound card conversion buffer is used
const double dDelayToFillNetworkPackets =
pClient->GetSndCrdActualMonoBlSize() *
pClient->GetSystemMonoBlSize() *
1000 / SYSTEM_SAMPLE_RATE;
// CELT additional delay at small frame sizes is half a frame size