added automatic network jitter buffer setting functionality
This commit is contained in:
parent
b0d0292314
commit
f84b9673bd
6 changed files with 48 additions and 33 deletions
|
@ -36,7 +36,7 @@ CClient::CClient ( const quint16 iPortNumber ) : bRun ( false ),
|
||||||
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ),
|
iNetwBufSizeFactIn ( DEF_NET_BLOCK_SIZE_FACTOR ),
|
||||||
strIPAddress ( "" ), strName ( "" ),
|
strIPAddress ( "" ), strName ( "" ),
|
||||||
bOpenChatOnNewMessage ( true ),
|
bOpenChatOnNewMessage ( true ),
|
||||||
bDoAutoSockBufSize ( false )
|
bDoAutoSockBufSize ( true )
|
||||||
{
|
{
|
||||||
// connection for protocol
|
// connection for protocol
|
||||||
QObject::connect ( &Channel,
|
QObject::connect ( &Channel,
|
||||||
|
|
|
@ -92,8 +92,8 @@ public:
|
||||||
AudioReverb.Clear();
|
AudioReverb.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDoAutoSockBufSize ( const bool bValue )
|
void SetDoAutoSockBufSize ( const bool bValue ) { bDoAutoSockBufSize = bValue; }
|
||||||
{ bDoAutoSockBufSize = bValue; }
|
bool GetDoAutoSockBufSize() { return bDoAutoSockBufSize; }
|
||||||
void SetSockBufSize ( const int iNumBlocks )
|
void SetSockBufSize ( const int iNumBlocks )
|
||||||
{
|
{
|
||||||
if ( Channel.GetSockBufSize() != iNumBlocks )
|
if ( Channel.GetSockBufSize() != iNumBlocks )
|
||||||
|
|
|
@ -83,8 +83,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
|
|
||||||
// network buffer
|
// network buffer
|
||||||
SliderNetBuf->setRange ( 0, MAX_NET_BUF_SIZE_NUM_BL );
|
SliderNetBuf->setRange ( 0, MAX_NET_BUF_SIZE_NUM_BL );
|
||||||
const int iCurNumNetBuf = pClient->GetSockBufSize();
|
UpdateJitterBufferFrame();
|
||||||
UpdateNetworkBufSlider ( iCurNumNetBuf );
|
|
||||||
|
|
||||||
// network buffer size factor in
|
// network buffer size factor in
|
||||||
SliderNetBufSiFactIn->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
SliderNetBufSiFactIn->setRange ( 1, MAX_NET_BLOCK_SIZE_FACTOR );
|
||||||
|
@ -144,7 +143,6 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
// timers
|
// timers
|
||||||
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerStatus, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerStatus() ) );
|
this, SLOT ( OnTimerStatus() ) );
|
||||||
|
|
||||||
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
QObject::connect ( &TimerPing, SIGNAL ( timeout() ),
|
||||||
this, SLOT ( OnTimerPing() ) );
|
this, SLOT ( OnTimerPing() ) );
|
||||||
|
|
||||||
|
@ -165,6 +163,8 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
// check boxes
|
// check boxes
|
||||||
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
QObject::connect ( cbOpenChatOnNewMessage, SIGNAL ( stateChanged ( int ) ),
|
||||||
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
|
this, SLOT ( OnOpenChatOnNewMessageStateChanged ( int ) ) );
|
||||||
|
QObject::connect ( cbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
|
||||||
|
this, SLOT ( OnAutoJitBuf ( int ) ) );
|
||||||
|
|
||||||
// combo boxes
|
// combo boxes
|
||||||
QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ),
|
QObject::connect ( cbSoundcard, SIGNAL ( activated ( int ) ),
|
||||||
|
@ -183,10 +183,17 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
|
||||||
TimerStatus.start ( DISPLAY_UPDATE_TIME );
|
TimerStatus.start ( DISPLAY_UPDATE_TIME );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::UpdateNetworkBufSlider ( const int iCurNumNetBuf )
|
void CClientSettingsDlg::UpdateJitterBufferFrame()
|
||||||
{
|
{
|
||||||
|
// update slider value and text
|
||||||
|
const int iCurNumNetBuf = pClient->GetSockBufSize();
|
||||||
SliderNetBuf->setValue ( iCurNumNetBuf );
|
SliderNetBuf->setValue ( iCurNumNetBuf );
|
||||||
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
TextNetBuf->setText ( "Size: " + QString().setNum ( iCurNumNetBuf ) );
|
||||||
|
|
||||||
|
// if auto setting is enabled, disable slider control
|
||||||
|
cbAutoJitBuf->setChecked ( pClient->GetDoAutoSockBufSize() );
|
||||||
|
SliderNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
||||||
|
TextNetBuf->setEnabled ( !pClient->GetDoAutoSockBufSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::UpdateSndBufInSlider ( const int iCurNumInBuf )
|
void CClientSettingsDlg::UpdateSndBufInSlider ( const int iCurNumInBuf )
|
||||||
|
@ -271,6 +278,12 @@ void CClientSettingsDlg::OnSoundCrdSelection ( int iSndDevIdx )
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CClientSettingsDlg::OnAutoJitBuf ( int value )
|
||||||
|
{
|
||||||
|
pClient->SetDoAutoSockBufSize ( value == Qt::Checked );
|
||||||
|
UpdateJitterBufferFrame();
|
||||||
|
}
|
||||||
|
|
||||||
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
|
void CClientSettingsDlg::OnOpenChatOnNewMessageStateChanged ( int value )
|
||||||
{
|
{
|
||||||
pClient->SetOpenChatOnNewMessage ( value == Qt::Checked );
|
pClient->SetOpenChatOnNewMessage ( value == Qt::Checked );
|
||||||
|
@ -353,9 +366,9 @@ void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
|
||||||
void CClientSettingsDlg::UpdateDisplay()
|
void CClientSettingsDlg::UpdateDisplay()
|
||||||
{
|
{
|
||||||
// update slider controls (settings might have been changed by sound interface)
|
// update slider controls (settings might have been changed by sound interface)
|
||||||
UpdateSndBufInSlider ( pClient->GetSndInterface()->GetInNumBuf() );
|
UpdateSndBufInSlider ( pClient->GetSndInterface()->GetInNumBuf() );
|
||||||
UpdateSndBufOutSlider ( pClient->GetSndInterface()->GetOutNumBuf() );
|
UpdateSndBufOutSlider ( pClient->GetSndInterface()->GetOutNumBuf() );
|
||||||
UpdateNetworkBufSlider ( pClient->GetSockBufSize() );
|
UpdateJitterBufferFrame();
|
||||||
|
|
||||||
if ( !pClient->IsRunning() )
|
if ( !pClient->IsRunning() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,9 +72,9 @@ protected:
|
||||||
virtual void showEvent ( QShowEvent* showEvent );
|
virtual void showEvent ( QShowEvent* showEvent );
|
||||||
virtual void hideEvent ( QHideEvent* hideEvent );
|
virtual void hideEvent ( QHideEvent* hideEvent );
|
||||||
|
|
||||||
void UpdateSndBufInSlider ( const int iCurNumInBuf );
|
void UpdateSndBufInSlider ( const int iCurNumInBuf );
|
||||||
void UpdateSndBufOutSlider ( const int iCurNumOutBuf );
|
void UpdateSndBufOutSlider ( const int iCurNumOutBuf );
|
||||||
void UpdateNetworkBufSlider ( const int iCurNumNetBuf );
|
void UpdateJitterBufferFrame();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void OnTimerStatus() { UpdateDisplay(); }
|
void OnTimerStatus() { UpdateDisplay(); }
|
||||||
|
@ -84,6 +84,7 @@ public slots:
|
||||||
void OnSliderNetBuf ( int value );
|
void OnSliderNetBuf ( int value );
|
||||||
void OnSliderNetBufSiFactIn ( int value );
|
void OnSliderNetBufSiFactIn ( int value );
|
||||||
void OnSliderNetBufSiFactOut ( int value );
|
void OnSliderNetBufSiFactOut ( int value );
|
||||||
|
void OnAutoJitBuf ( int value );
|
||||||
void OnOpenChatOnNewMessageStateChanged ( int value );
|
void OnOpenChatOnNewMessageStateChanged ( int value );
|
||||||
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
|
void OnAudioCompressionButtonGroupClicked ( QAbstractButton* button );
|
||||||
void OnPingTimeResult ( int iPingTime );
|
void OnPingTimeResult ( int iPingTime );
|
||||||
|
|
|
@ -25,21 +25,13 @@
|
||||||
<string>Jitter Buffer</string>
|
<string>Jitter Buffer</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="spacing" >
|
<item>
|
||||||
<number>6</number>
|
<widget class="QCheckBox" name="cbAutoJitBuf" >
|
||||||
</property>
|
<property name="text" >
|
||||||
<property name="leftMargin" >
|
<string>Auto</string>
|
||||||
<number>9</number>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="topMargin" >
|
</item>
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="TextNetBuf" >
|
<widget class="QLabel" name="TextNetBuf" >
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
|
|
|
@ -104,6 +104,12 @@ void CSettings::ReadIniFile ( const QString& sFileName )
|
||||||
pClient->GetSndInterface()->SetOutNumBuf ( iValue );
|
pClient->GetSndInterface()->SetOutNumBuf ( iValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// automatic network jitter buffer size setting
|
||||||
|
if ( GetFlagIniSet ( IniXMLDocument, "client", "autojitbuf", bValue ) )
|
||||||
|
{
|
||||||
|
pClient->SetDoAutoSockBufSize ( bValue );
|
||||||
|
}
|
||||||
|
|
||||||
// network jitter buffer size
|
// network jitter buffer size
|
||||||
if ( GetNumericIniSet ( IniXMLDocument, "client", "jitbuf", 0, MAX_NET_BUF_SIZE_NUM_BL, iValue ) )
|
if ( GetNumericIniSet ( IniXMLDocument, "client", "jitbuf", 0, MAX_NET_BUF_SIZE_NUM_BL, iValue ) )
|
||||||
{
|
{
|
||||||
|
@ -180,6 +186,9 @@ void CSettings::WriteIniFile ( const QString& sFileName )
|
||||||
// sound card out number of buffers
|
// sound card out number of buffers
|
||||||
SetNumericIniSet ( IniXMLDocument, "client", "audoutbuf", pClient->GetSndInterface()->GetOutNumBuf() );
|
SetNumericIniSet ( IniXMLDocument, "client", "audoutbuf", pClient->GetSndInterface()->GetOutNumBuf() );
|
||||||
|
|
||||||
|
// automatic network jitter buffer size setting
|
||||||
|
SetFlagIniSet ( IniXMLDocument, "client", "autojitbuf", pClient->GetDoAutoSockBufSize() );
|
||||||
|
|
||||||
// network jitter buffer size
|
// network jitter buffer size
|
||||||
SetNumericIniSet ( IniXMLDocument, "client", "jitbuf", pClient->GetSockBufSize() );
|
SetNumericIniSet ( IniXMLDocument, "client", "jitbuf", pClient->GetSockBufSize() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue