bug fix with overall delay calculation if sound card conversion buffer is used
This commit is contained in:
parent
9f3d07ca67
commit
1c76d2e8fe
4 changed files with 30 additions and 7 deletions
|
@ -1,5 +1,10 @@
|
||||||
3.0.4
|
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
|
- 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
|
- bug fix: buzzing occurred when audio stream was interrupted (e.g. in case
|
||||||
of network trouble)
|
of network trouble)
|
||||||
|
|
||||||
|
|
||||||
3.0.0
|
3.0.0
|
||||||
|
|
||||||
- introduced new audio codec "CELT", not compatible to old versions
|
- introduced new audio codec "CELT", not compatible to old versions
|
||||||
|
|
|
@ -355,7 +355,6 @@ void CClient::Init()
|
||||||
iSndCrdFrameSizeFactor = iMonoBlockSizeSam / SYSTEM_FRAME_SIZE_SAMPLES;
|
iSndCrdFrameSizeFactor = iMonoBlockSizeSam / SYSTEM_FRAME_SIZE_SAMPLES;
|
||||||
|
|
||||||
// no sound card conversion buffer required
|
// no sound card conversion buffer required
|
||||||
iSndCardMonoBlockSizeSamConvBuff = 0; // this is important!
|
|
||||||
bSndCrdConversionBufferRequired = false;
|
bSndCrdConversionBufferRequired = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -640,7 +639,8 @@ void CClient::UpdateSocketBufferSize()
|
||||||
|
|
||||||
// calculate current buffer setting
|
// calculate current buffer setting
|
||||||
const double dAudioBufferDurationMs =
|
const double dAudioBufferDurationMs =
|
||||||
( iMonoBlockSizeSam + iSndCardMonoBlockSizeSamConvBuff ) *
|
( GetSndCrdActualMonoBlSize() +
|
||||||
|
GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
|
||||||
1000 / SYSTEM_SAMPLE_RATE;
|
1000 / SYSTEM_SAMPLE_RATE;
|
||||||
|
|
||||||
// jitter introduced in the server by the timer implementation
|
// jitter introduced in the server by the timer implementation
|
||||||
|
|
16
src/client.h
16
src/client.h
|
@ -142,13 +142,27 @@ public:
|
||||||
// sound card conversion buffer is used or not
|
// sound card conversion buffer is used or not
|
||||||
if ( bSndCrdConversionBufferRequired )
|
if ( bSndCrdConversionBufferRequired )
|
||||||
{
|
{
|
||||||
return iSndCardMonoBlockSizeSamConvBuff + iMonoBlockSizeSam;
|
return iSndCardMonoBlockSizeSamConvBuff;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return iMonoBlockSizeSam;
|
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 GetFraSiFactPrefSupported() { return bFraSiFactPrefSupported; }
|
||||||
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }
|
bool GetFraSiFactDefSupported() { return bFraSiFactDefSupported; }
|
||||||
|
|
|
@ -508,14 +508,18 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
||||||
|
|
||||||
// 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, also consider delay introduced by
|
||||||
|
// sound card conversion buffer by using
|
||||||
|
// "GetSndCrdConvBufAdditionalDelayMonoBlSize"
|
||||||
const double dTotalSoundCardDelayMS =
|
const double dTotalSoundCardDelayMS =
|
||||||
3 * pClient->GetSndCrdActualMonoBlSize() *
|
( 3 * pClient->GetSndCrdActualMonoBlSize() +
|
||||||
|
pClient->GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
|
||||||
1000 / SYSTEM_SAMPLE_RATE;
|
1000 / SYSTEM_SAMPLE_RATE;
|
||||||
|
|
||||||
// network packets are of the same size as the audio packets per definition
|
// network packets are of the same size as the audio packets per definition
|
||||||
|
// if no sound card conversion buffer is used
|
||||||
const double dDelayToFillNetworkPackets =
|
const double dDelayToFillNetworkPackets =
|
||||||
pClient->GetSndCrdActualMonoBlSize() *
|
pClient->GetSystemMonoBlSize() *
|
||||||
1000 / SYSTEM_SAMPLE_RATE;
|
1000 / SYSTEM_SAMPLE_RATE;
|
||||||
|
|
||||||
// CELT additional delay at small frame sizes is half a frame size
|
// CELT additional delay at small frame sizes is half a frame size
|
||||||
|
|
Loading…
Add table
Reference in a new issue