most of the work done for separate client/server jitter buffer settings but not yet finished (does not work as expected yet)

This commit is contained in:
Volker Fischer 2011-05-27 20:29:37 +00:00
parent 691e593e0b
commit 439dd65b46
11 changed files with 413 additions and 225 deletions

View file

@ -28,9 +28,9 @@
// CChannel implementation *****************************************************
CChannel::CChannel ( const bool bNIsServer ) :
vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ),
bDoAutoSockBufSize ( true ),
bIsEnabled ( false ),
bIsServer ( bNIsServer ),
bDoAutoSockBufSize ( true ),
iNetwFrameSizeFact ( FRAME_SIZE_FACTOR_PREFERRED ),
iNetwFrameSize ( 20 ), // must be > 0 and should be close to a valid size
iNumAudioChannels ( 1 ) // mono
@ -180,18 +180,18 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
// block size
SockBuf.Init ( iNetwFrameSize, iNewNumFrames, bPreserve );
// in case we are the client and a change in the buffer is done (not
// an initialization, we assume that "preserve" is only used in case
// the buffer is changed), tell the server that the size has changed
if ( !bIsServer && bPreserve )
// only in case we are the server and auto jitter buffer setting is
// enabled, we have to report the current setting to the client
if ( bIsServer && bDoAutoSockBufSize )
{
// we cannot call the "CreateJitBufMes" function directly since
// this would give us problems with different threads (e.g. the
// audio thread) and the protocol mechanism (problem with
// timer thread) and the protocol mechanism (problem with
// qRegisterMetaType(), etc.)
// reuse the request jitter buffer size signal here since it
// does exactly what we want
emit ReqJittBufSize();
// TODO create new message, this one only works for client...
//emit ReqJittBufSize();
}
return false; // -> no error
@ -201,7 +201,26 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
return true; // set error flag
}
void CChannel::SetGain ( const int iChanID, const double dNewGain )
void CChannel::SetDoAutoSockBufSize ( const bool bValue )
{
// in case auto socket buffer size was just enabled, reset statistic and in
// case of the client, inform the server about the change
if ( ( bDoAutoSockBufSize != bValue ) && bValue )
{
CycleTimeVariance.Reset();
if ( !bIsServer )
{
CreateJitBufMes ( AUTO_NET_BUF_SIZE_FOR_PROTOCOL );
}
}
// store new setting
bDoAutoSockBufSize = bValue;
}
void CChannel::SetGain ( const int iChanID,
const double dNewGain )
{
QMutexLocker locker ( &Mutex );
@ -276,10 +295,19 @@ void CChannel::OnSendProtMessage ( CVector<uint8_t> vecMessage )
void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
{
SetSockBufNumFrames ( iNewJitBufSize, true );
// first check for special case: auto setting
if ( iNewJitBufSize == AUTO_NET_BUF_SIZE_FOR_PROTOCOL )
{
SetDoAutoSockBufSize ( true );
}
else
{
SetSockBufNumFrames ( iNewJitBufSize, true );
}
}
void CChannel::OnChangeChanGain ( int iChanID, double dNewGain )
void CChannel::OnChangeChanGain ( int iChanID,
double dNewGain )
{
SetGain ( iChanID, dNewGain );
}
@ -426,8 +454,8 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
}
// update cycle time variance measurement (this is only
// used by the client so do not update for server channel)
if ( !bIsServer )
// used in case auto socket buffer size is enabled)
if ( bDoAutoSockBufSize )
{
CycleTimeVariance.Update();
}
@ -466,7 +494,7 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
// TODO check the conditions: !bIsProtocolPacket should always be true
// since we can only get here if bNewConnection, should we really put
// !bIsAudioPacket in here, because shouldn't we always quere the audio
// !bIsAudioPacket in here, because shouldn't we always query the audio
// properties on a new connection?
if ( bIsServer && ( !bIsProtocolPacket ) && ( !bIsAudioPacket ) )
@ -587,23 +615,30 @@ void CChannel::UpdateSocketBufferSize ( const double dAudioBufferDurationMs,
// time in case the time response measurement is close to a bound
// - only use time response measurement results if averaging buffer is
// completely filled
// - we need at least a jitter buffer size of the audio packet duration
// -> add audio buffer duration
const double dHysteresis = 0.3;
// jitter introduced in the server by the timer implementation
// TODO remove this!
const double dServerJitterMs = 0.666666; // ms
// accumulate the standard deviations of input network stream and
// internal timer,
// add 0.5 to "round up" -> ceil,
// divide by MIN_SERVER_BLOCK_DURATION_MS because this is the size of
// one block in the jitter buffer
const double dEstCurBufSet = ( dAudioBufferDurationMs + dServerJitterMs +
3.3 * ( GetTimingStdDev() + dLocalStdDev ) ) /
const double dEstCurBufSet = ( dAudioBufferDurationMs +
3.3 * ( CycleTimeVariance.GetStdDev() + dLocalStdDev ) ) /
SYSTEM_BLOCK_DURATION_MS_FLOAT + 0.5;
/*
// TEST
//if (bIsServer) {
static FILE* pFile = fopen ( "c:\\temp\\test.dat", "w" );
fprintf ( pFile, "%e %e %e %e\n", CycleTimeVariance.GetStdDev(), dLocalStdDev, dAudioBufferDurationMs, dEstCurBufSet );
fflush ( pFile );
// close;x=read('c:/temp/test.dat',-1,4);plot(x)
//}
*/
// upper/lower hysteresis decision
const int iUpperHystDec = LlconMath().round ( dEstCurBufSet - dHysteresis );
const int iLowerHystDec = LlconMath().round ( dEstCurBufSet + dHysteresis );

View file

@ -101,14 +101,12 @@ public:
int GetUploadRateKbps();
double GetTimingStdDev() { return CycleTimeVariance.GetStdDev(); }
// set/get network out buffer size and size factor
void SetAudioStreamProperties ( const int iNewNetwFrameSize,
const int iNewNetwFrameSizeFact,
const int iNewNumAudioChannels );
void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; }
void SetDoAutoSockBufSize ( const bool bValue );
bool GetDoAutoSockBufSize() const { return bDoAutoSockBufSize; }
int GetNetwFrameSizeFact() const { return iNetwFrameSizeFact; }
@ -150,6 +148,7 @@ protected:
// network jitter-buffer
CNetBuf SockBuf;
int iCurSockBufNumFrames;
bool bDoAutoSockBufSize;
CCycleTimeVariance CycleTimeVariance;
@ -165,7 +164,6 @@ protected:
bool bIsEnabled;
bool bIsServer;
bool bDoAutoSockBufSize;
int iNetwFrameSizeFact;
int iNetwFrameSize;

View file

@ -48,7 +48,8 @@ CClient::CClient ( const quint16 iPortNumber ) :
bOpenChatOnNewMessage ( true ),
eGUIDesign ( GD_ORIGINAL ),
strCentralServerAddress ( "" ),
bUseDefaultCentralServerAddress ( true )
bUseDefaultCentralServerAddress ( true ),
iServerSockBufNumFrames ( DEF_NET_BUF_SIZE_NUM_BL )
{
// init audio encoder/decoder (mono)
CeltModeMono = celt_mode_create (
@ -166,7 +167,21 @@ void CClient::OnNewConnection()
// not get the list because the server does not know about a new connection.
// Same problem is with the jitter buffer message.
Channel.CreateReqConnClientsList();
Channel.CreateJitBufMes ( Channel.GetSockBufNumFrames() );
CreateServerJitterBufferMessage();
}
void CClient::CreateServerJitterBufferMessage()
{
// in case auto jitter buffer size is enabled, we have to transmit a
// special value
if ( GetDoAutoSockBufSize() )
{
Channel.CreateJitBufMes ( AUTO_NET_BUF_SIZE_FOR_PROTOCOL );
}
else
{
Channel.CreateJitBufMes ( GetServerSockBufNumFrames() );
}
}
void CClient::OnCLPingReceived ( CHostAddress InetAddr,
@ -906,11 +921,11 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
// calculate current buffer setting
const double dAudioBufferDurationMs =
( GetSndCrdActualMonoBlSize() +
GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
static_cast<double> ( GetSndCrdActualMonoBlSize() +
GetSndCrdConvBufAdditionalDelayMonoBlSize() ) *
1000 / SYSTEM_SAMPLE_RATE_HZ;
// update and socket buffer size
// update socket buffer size
Channel.UpdateSocketBufferSize ( dAudioBufferDurationMs,
CycleTimeVariance.GetStdDev() );
}
@ -923,10 +938,11 @@ int CClient::EstimatedOverallDelay ( const int iPingTimeMs )
for the average it is assumed that the buffer is half filled)
- consider the jitter buffer on the server side, too
*/
// 2 times buffers at client and server divided by 2 (half the buffer
// for the delay) is simply the total socket buffer size
const double dTotalJitterBufferDelayMs =
SYSTEM_BLOCK_DURATION_MS_FLOAT * GetSockBufNumFrames();
// the buffer sizes at client and server divided by 2 (half the buffer
// for the delay) is the total socket buffer size
const double dTotalJitterBufferDelayMs = SYSTEM_BLOCK_DURATION_MS_FLOAT *
static_cast<double> ( GetSockBufNumFrames() +
GetServerSockBufNumFrames() ) / 2;
// 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)

View file

@ -144,6 +144,18 @@ public:
}
int GetSockBufNumFrames() { return Channel.GetSockBufNumFrames(); }
void SetServerSockBufNumFrames ( const int iNumBlocks )
{
iServerSockBufNumFrames = iNumBlocks;
// if auto setting is disabled, inform the server about the new size
if ( !GetDoAutoSockBufSize() )
{
Channel.CreateJitBufMes ( iServerSockBufNumFrames );
}
}
int GetServerSockBufNumFrames() { return iServerSockBufNumFrames; }
int GetUploadRateKbps() { return Channel.GetUploadRateKbps(); }
// sound card device selection
@ -250,6 +262,7 @@ protected:
int PreparePingMessage();
int EvaluatePingMessage ( const int iMs );
void CreateServerJitterBufferMessage();
// only one channel is needed for client application
CChannel Channel;
@ -305,6 +318,9 @@ protected:
CVector<double> vecdAudioStereo;
CVector<int16_t> vecsNetwork;
// server settings
int iServerSockBufNumFrames;
// for ping measurement
CPreciseTime PreciseTime;
@ -313,7 +329,7 @@ protected:
public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnDetectedCLMessage ( CVector<uint8_t> vecbyData, int iNumBytes );
void OnReqJittBufSize() { Channel.CreateJitBufMes ( Channel.GetSockBufNumFrames() ); }
void OnReqJittBufSize() { CreateServerJitterBufferMessage(); }
void OnReqChanName() { Channel.SetRemoteName ( strName ); }
void OnNewConnection();
void OnCLPingReceived ( CHostAddress InetAddr,

View file

@ -39,37 +39,45 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
"size of this jitter buffer has therefore influence on the quality of "
"the audio stream (how many dropouts occur) and the overall delay "
"(the longer the buffer, the higher the delay).<br>"
"Dropouts in the audio stream are indicated by the light on the bottom "
"of the jitter buffer size fader. If the light turns to red, a buffer "
"The jitter buffer size can be manually chosen for the local client "
"and the remote server. For the local jitter buffer, dropouts in the "
"audio stream are indicated by the light on the bottom "
"of the jitter buffer size faders. If the light turns to red, a buffer "
"overrun/underrun took place and the audio stream is interrupted.<br>"
"The jitter buffer setting is therefore a trade-off between audio "
"quality and overall delay.<br>"
"An auto setting of the jitter buffer size setting is available. If "
"the check Auto is enabled, the jitter buffer is set automatically "
"the check Auto is enabled, the jitter buffers of the local client and "
"the remote server are set automatically "
"based on measurements of the network and sound card timing jitter. If "
"the Auto check is enabled, the jitter buffer size fader is disabled "
"(it cannot be moved by the mouse)." );
"the <i>auto</i> check is enabled, the jitter buffer size faders are "
"disabled (they cannot be moved with the mouse)." );
QString strJitterBufferSizeTT = tr ( "In case the Auto setting of the "
"jitter buffer is enabled, the network buffer is set to a conservative "
QString strJitterBufferSizeTT = tr ( "In case the auto setting of the "
"jitter buffer is enabled, the network buffers of the local client and "
"the remote server are set to a conservative "
"value to minimize the audio dropout probability. To <b>tweak the "
"audio delay/latency</b> it is recommended to disable the Auto "
"audio delay/latency</b> it is recommended to disable the auto setting "
"functionality and to <b>lower the jitter buffer size manually</b> by "
"using the slider until your personal acceptable limit of the amount "
"using the sliders until your personal acceptable limit of the amount "
"of dropouts is reached. The LED indicator will visualize the audio "
"dropouts by a red light" ) + TOOLTIP_COM_END_TEXT;
"dropouts of the local jitter buffer by a red light" ) +
TOOLTIP_COM_END_TEXT;
TextNetBuf->setWhatsThis ( strJitterBufferSize );
TextNetBuf->setToolTip ( strJitterBufferSizeTT );
grbJitterBuffer->setWhatsThis ( strJitterBufferSize );
grbJitterBuffer->setToolTip ( strJitterBufferSizeTT );
sldNetBuf->setWhatsThis ( strJitterBufferSize );
sldNetBuf->setAccessibleName ( tr ( "Jitter buffer slider control" ) );
sldNetBuf->setToolTip ( strJitterBufferSizeTT );
chbAutoJitBuf->setAccessibleName ( tr ( "Auto jitter buffer switch" ) );
chbAutoJitBuf->setToolTip ( strJitterBufferSizeTT );
ledNetw->setAccessibleName ( tr ( "Jitter buffer status LED indicator" ) );
ledNetw->setToolTip ( strJitterBufferSizeTT );
lblNetBuf->setWhatsThis ( strJitterBufferSize );
lblNetBuf->setToolTip ( strJitterBufferSizeTT );
grbJitterBuffer->setWhatsThis ( strJitterBufferSize );
grbJitterBuffer->setToolTip ( strJitterBufferSizeTT );
sldNetBuf->setWhatsThis ( strJitterBufferSize );
sldNetBuf->setAccessibleName ( tr ( "Local jitter buffer slider control" ) );
sldNetBuf->setToolTip ( strJitterBufferSizeTT );
sldNetBufServer->setWhatsThis ( strJitterBufferSize );
sldNetBufServer->setAccessibleName ( tr ( "Server jitter buffer slider control" ) );
sldNetBufServer->setToolTip ( strJitterBufferSizeTT );
chbAutoJitBuf->setAccessibleName ( tr ( "Auto jitter buffer switch" ) );
chbAutoJitBuf->setToolTip ( strJitterBufferSizeTT );
ledNetw->setAccessibleName ( tr ( "Jitter buffer status LED indicator" ) );
ledNetw->setToolTip ( strJitterBufferSizeTT );
// sound card device
cbxSoundcard->setWhatsThis ( tr ( "<b>Sound Card Device:</b> The ASIO "
@ -262,8 +270,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
// init slider controls ---
// network buffer
sldNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
// network buffer sliders
sldNetBuf->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
sldNetBufServer->setRange ( MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL );
UpdateJitterBufferFrame();
// init combo box containing all available sound cards in the system
@ -357,6 +366,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( sldNetBuf, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnNetBufValueChanged ( int ) ) );
QObject::connect ( sldNetBufServer, SIGNAL ( valueChanged ( int ) ),
this, SLOT ( OnNetBufServerValueChanged ( int ) ) );
// check boxes
QObject::connect ( chbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
@ -416,12 +428,20 @@ void CClientSettingsDlg::UpdateJitterBufferFrame()
// update slider value and text
const int iCurNumNetBuf = pClient->GetSockBufNumFrames();
sldNetBuf->setValue ( iCurNumNetBuf );
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
lblNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
const int iCurNumNetBufServer = pClient->GetServerSockBufNumFrames();
sldNetBufServer->setValue ( iCurNumNetBufServer );
lblNetBufServer->setText ( "Size: " + QString().setNum ( iCurNumNetBufServer ) );
// if auto setting is enabled, disable slider control
chbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
sldNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
chbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
sldNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
lblNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
lblNetBufLabel->setEnabled ( !pClient->GetDoAutoSockBufSize() );
sldNetBufServer->setEnabled ( !pClient->GetDoAutoSockBufSize() );
lblNetBufServer->setEnabled ( !pClient->GetDoAutoSockBufSize() );
lblNetBufServerLabel->setEnabled ( !pClient->GetDoAutoSockBufSize() );
}
QString CClientSettingsDlg::GenSndCrdBufferDelayString ( const int iFrameSize,
@ -550,6 +570,12 @@ void CClientSettingsDlg::OnNetBufValueChanged ( int value )
UpdateJitterBufferFrame();
}
void CClientSettingsDlg::OnNetBufServerValueChanged ( int value )
{
pClient->SetServerSockBufNumFrames ( value );
UpdateJitterBufferFrame();
}
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
{
pClient->SetSndCrdPrefFrameSizeFactor ( value );

View file

@ -85,6 +85,7 @@ protected:
public slots:
void OnTimerStatus() { UpdateDisplay(); }
void OnNetBufValueChanged ( int value );
void OnNetBufServerValueChanged ( int value );
void OnSliderSndCrdBufferDelay ( int value );
void OnAutoJitBufStateChanged ( int value );
void OnOpenChatOnNewMessageStateChanged ( int value );

View file

@ -5,7 +5,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<width>567</width>
<height>351</height>
</rect>
</property>
@ -19,163 +19,6 @@
<bool>true</bool>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QGroupBox" name="grbJitterBuffer" >
<property name="title" >
<string>Jitter Buffer</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="chbAutoJitBuf" >
<property name="text" >
<string>Auto</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextNetBuf" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Size</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="sldNetBuf" >
<property name="pageStep" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBothSides</enum>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="CMultiColorLED" native="1" name="ledNetw" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grbSoundCard" >
<property name="title" >
@ -402,6 +245,241 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grbJitterBuffer" >
<property name="title" >
<string>Jitter Buffer</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QCheckBox" name="chbAutoJitBuf" >
<property name="text" >
<string>Auto</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="lblNetBufLabel" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Local</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblNetBufServerLabel" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Server</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="lblNetBuf" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Size</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblNetBufServer" >
<property name="minimumSize" >
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>Size</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="sldNetBuf" >
<property name="pageStep" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBothSides</enum>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSlider" name="sldNetBufServer" >
<property name="pageStep" >
<number>1</number>
</property>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBothSides</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="CMultiColorLED" native="1" name="ledNetw" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="grbMeasureResults" >
<property name="title" >

View file

@ -114,8 +114,9 @@ LED bar: lbr
#define MAX_SIZE_BYTES_NETW_BUF ( MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ * 4 )
// minimum/maximum network buffer size (which can be chosen by slider)
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks
#define MAX_NET_BUF_SIZE_NUM_BL 20 // number of blocks
#define AUTO_NET_BUF_SIZE_FOR_PROTOCOL -1 // auto set parameter (only used for protocol)
// default network buffer size
#define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks

View file

@ -648,8 +648,9 @@ bool CProtocol::EvaluateJitBufMes ( const CVector<uint8_t>& vecData )
const int iData =
static_cast<int> ( GetValFromStream ( vecData, iPos, 2 ) );
if ( ( iData < MIN_NET_BUF_SIZE_NUM_BL ) ||
( iData > MAX_NET_BUF_SIZE_NUM_BL ) )
if ( ( ( iData < MIN_NET_BUF_SIZE_NUM_BL ) ||
( iData > MAX_NET_BUF_SIZE_NUM_BL ) ) &&
( iData != AUTO_NET_BUF_SIZE_FOR_PROTOCOL ) )
{
return true; // return error code
}

View file

@ -662,6 +662,11 @@ void CServer::OnTimer()
Socket.SendPacket (
vecChannels[iCurChanID].PrepSendPacket ( vecCeltData ),
vecChannels[iCurChanID].GetAddress() );
// update socket buffer size
vecChannels[iCurChanID].UpdateSocketBufferSize (
SYSTEM_BLOCK_DURATION_MS_FLOAT,
CycleTimeVariance.GetStdDev() );
}
}
else

View file

@ -164,6 +164,13 @@ void CSettings::Load()
pClient->SetSockBufNumFrames ( iValue );
}
// network jitter buffer size for server
if ( GetNumericIniSet ( IniXMLDocument, "client", "jitbufserver",
MIN_NET_BUF_SIZE_NUM_BL, MAX_NET_BUF_SIZE_NUM_BL, iValue ) )
{
pClient->SetServerSockBufNumFrames ( iValue );
}
// flag whether the chat window shall be opened on a new chat message
if ( GetFlagIniSet ( IniXMLDocument, "client", "openchatonnewmessage", bValue ) )
{
@ -307,6 +314,10 @@ void CSettings::Save()
SetNumericIniSet ( IniXMLDocument, "client", "jitbuf",
pClient->GetSockBufNumFrames() );
// network jitter buffer size for server
SetNumericIniSet ( IniXMLDocument, "client", "jitbufserver",
pClient->GetServerSockBufNumFrames() );
// flag whether the chat window shall be opened on a new chat message
SetFlagIniSet ( IniXMLDocument, "client", "openchatonnewmessage",
pClient->GetOpenChatOnNewMessage() );