added Enable Small Network Buffers switch

This commit is contained in:
Volker Fischer 2020-04-17 21:21:37 +02:00
parent 752b38e4e6
commit 79c0047bb3
7 changed files with 82 additions and 13 deletions

View file

@ -6,6 +6,10 @@
* added a Mute Stream button to hear your signal and the signal of the other clients but * added a Mute Stream button to hear your signal and the signal of the other clients but
do not transmit your signal to the server so that the other clients cannot hear you do not transmit your signal to the server so that the other clients cannot hear you
* added Enable Small Network Buffers switch to enable small sound card buffers in
combination with legacy OPUS packets since OPUS packets with 64 samples enable low
latency but can increase audio drop outs
* upgrade OPUS codec library to v1.3.1 by doloopuntil * upgrade OPUS codec library to v1.3.1 by doloopuntil
* improved auto jitter buffer for 64 samples frame size * improved auto jitter buffer for 64 samples frame size
@ -13,10 +17,16 @@
* the ping times in the server list are now more stable * the ping times in the server list are now more stable
TODO we need a switch to enable OPUS64 packets (otherwise it is not possible to use very small sound card buffers with the normal OPUS 128 samples frame size) TODO store Show All Musicians setting in the ini-file
TODO bug fix: "Start up the new version with the Connection Setup showing. "Show all musicians" is on (as I say). Switch it off before the list is displayed. The
checkbox is off - but the list displays all musicians! You need to turn it on and off again to get it to do its thing. (If you wait a little, it's fine -
i.e. before it's populated the musicians but after it's displayed the list, turn it off.)", see https://github.com/corrados/jamulus/issues/78
TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f) TODO offer the Jamulus ASIO settingspanel in case of an ASIO ERROR to fix, e.g., incorrect sample rate (https://sourceforge.net/p/llcon/discussion/533517/thread/777663cf94/#035f)
TODO the server list filter seems not to work if --showallservers is used
TODO store Central Server jamulus.server start scripts on the Repo (one for Central Server, one for Central Server North America) TODO store Central Server jamulus.server start scripts on the Repo (one for Central Server, one for Central Server North America)

View file

@ -71,6 +71,7 @@ CClient::CClient ( const quint16 iPortNumber,
bFraSiFactSafeSupported ( false ), bFraSiFactSafeSupported ( false ),
eGUIDesign ( GD_ORIGINAL ), eGUIDesign ( GD_ORIGINAL ),
bDisplayChannelLevels ( true ), bDisplayChannelLevels ( true ),
bEnableOPUS64 ( false ),
bJitterBufferOK ( true ), bJitterBufferOK ( true ),
strCentralServerAddress ( "" ), strCentralServerAddress ( "" ),
eCentralServerAddressType ( AT_DEFAULT ), eCentralServerAddressType ( AT_DEFAULT ),
@ -431,6 +432,26 @@ void CClient::SetSndCrdPrefFrameSizeFactor ( const int iNewFactor )
} }
} }
void CClient::SetEnableOPUS64 ( const bool eNEnableOPUS64 )
{
// init with new parameter, if client was running then first
// stop it and restart again after new initialization
const bool bWasRunning = Sound.IsRunning();
if ( bWasRunning )
{
Sound.Stop();
}
// set new parameter
bEnableOPUS64 = eNEnableOPUS64;
Init();
if ( bWasRunning )
{
Sound.Start();
}
}
void CClient::SetAudioQuality ( const EAudioQuality eNAudioQuality ) void CClient::SetAudioQuality ( const EAudioQuality eNAudioQuality )
{ {
// init with new parameter, if client was running then first // init with new parameter, if client was running then first
@ -686,7 +707,7 @@ void CClient::Init()
// Calculate the current sound card frame size factor. In case // Calculate the current sound card frame size factor. In case
// the current mono block size is not a multiple of the system // the current mono block size is not a multiple of the system
// frame size, we have to use a sound card conversion buffer. // frame size, we have to use a sound card conversion buffer.
if ( ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED ) ) || if ( ( ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_PREFERRED ) ) && bEnableOPUS64 ) ||
( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT ) ) || ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_DEFAULT ) ) ||
( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE ) ) ) ( iMonoBlockSizeSam == ( SYSTEM_FRAME_SIZE_SAMPLES * FRAME_SIZE_FACTOR_SAFE ) ) )
{ {
@ -713,7 +734,7 @@ void CClient::Init()
// select the OPUS frame size mode depending on current mono block size samples // select the OPUS frame size mode depending on current mono block size samples
if ( bSndCrdConversionBufferRequired ) if ( bSndCrdConversionBufferRequired )
{ {
if ( iSndCardMonoBlockSizeSamConvBuff < DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ) if ( ( iSndCardMonoBlockSizeSamConvBuff < DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ) && bEnableOPUS64 )
{ {
iMonoBlockSizeSam = SYSTEM_FRAME_SIZE_SAMPLES; iMonoBlockSizeSam = SYSTEM_FRAME_SIZE_SAMPLES;
eAudioCompressionType = CT_OPUS64; eAudioCompressionType = CT_OPUS64;

View file

@ -204,6 +204,9 @@ public:
void SetSndCrdPrefFrameSizeFactor ( const int iNewFactor ); void SetSndCrdPrefFrameSizeFactor ( const int iNewFactor );
int GetSndCrdPrefFrameSizeFactor() { return iSndCrdPrefFrameSizeFactor; } int GetSndCrdPrefFrameSizeFactor() { return iSndCrdPrefFrameSizeFactor; }
void SetEnableOPUS64 ( const bool eNEnableOPUS64 );
bool GetEnableOPUS64() { return bEnableOPUS64; }
int GetSndCrdActualMonoBlSize() int GetSndCrdActualMonoBlSize()
{ {
// the actual sound card mono block size depends on whether a // the actual sound card mono block size depends on whether a
@ -366,6 +369,7 @@ protected:
EGUIDesign eGUIDesign; EGUIDesign eGUIDesign;
bool bDisplayChannelLevels; bool bDisplayChannelLevels;
bool bEnableOPUS64;
bool bJitterBufferOK; bool bJitterBufferOK;

View file

@ -121,6 +121,16 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
cbxROutChan->setWhatsThis ( strSndCrdChanMapp ); cbxROutChan->setWhatsThis ( strSndCrdChanMapp );
cbxROutChan->setAccessibleName ( tr ( "Right output channel selection combo box" ) ); cbxROutChan->setAccessibleName ( tr ( "Right output channel selection combo box" ) );
// enable OPUS64
chbEnableOPUS64->setWhatsThis ( tr ( "<b>Enable Small Network Buffers:</b> If enabled, "
"the support for very small network audio packets is activated. Very small "
"network packets are only actually used if the sound card buffer delay is smaller than " ) +
QString().setNum ( DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ) + tr ( " samples. The "
"smaller the network buffers, the smaller the audio latency. But at the same time "
"the network load increases and the probability of audio dropouts also increases." ) );
chbEnableOPUS64->setAccessibleName ( tr ( "Enable small network buffers check box" ) );
// sound card buffer delay // sound card buffer delay
QString strSndCrdBufDelay = tr ( "<b>Sound Card Buffer Delay:</b> The " QString strSndCrdBufDelay = tr ( "<b>Sound Card Buffer Delay:</b> The "
"buffer delay setting is a fundamental setting of the " ) + "buffer delay setting is a fundamental setting of the " ) +
@ -317,7 +327,7 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
chbGUIDesignFancy->setCheckState ( Qt::Checked ); chbGUIDesignFancy->setCheckState ( Qt::Checked );
} }
// Display Channel Levels check box // Display Channel Levels check box
chbDisplayChannelLevels->setCheckState ( pClient->GetDisplayChannelLevels() ? Qt::Checked : Qt::Unchecked ); chbDisplayChannelLevels->setCheckState ( pClient->GetDisplayChannelLevels() ? Qt::Checked : Qt::Unchecked );
// "Audio Channels" combo box // "Audio Channels" combo box
@ -345,6 +355,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
// update new client fader level edit box // update new client fader level edit box
edtNewClientLevel->setText ( QString::number ( pClient->iNewClientFaderLevel ) ); edtNewClientLevel->setText ( QString::number ( pClient->iNewClientFaderLevel ) );
// update enable small network buffers check box
chbEnableOPUS64->setCheckState ( pClient->GetEnableOPUS64() ? Qt::Checked : Qt::Unchecked );
// set text for sound card buffer delay radio buttons // set text for sound card buffer delay radio buttons
rbtBufferDelayPreferred->setText ( GenSndCrdBufferDelayString ( rbtBufferDelayPreferred->setText ( GenSndCrdBufferDelayString (
FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES ) ); FRAME_SIZE_FACTOR_PREFERRED * SYSTEM_FRAME_SIZE_SAMPLES ) );
@ -386,6 +399,9 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
QObject::connect ( chbAutoJitBuf, SIGNAL ( stateChanged ( int ) ), QObject::connect ( chbAutoJitBuf, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnAutoJitBufStateChanged ( int ) ) ); this, SLOT ( OnAutoJitBufStateChanged ( int ) ) );
QObject::connect ( chbEnableOPUS64, SIGNAL ( stateChanged ( int ) ),
this, SLOT ( OnEnableOPUS64StateChanged ( int ) ) );
// line edits // line edits
QObject::connect ( edtCentralServerAddress, SIGNAL ( editingFinished() ), QObject::connect ( edtCentralServerAddress, SIGNAL ( editingFinished() ),
this, SLOT ( OnCentralServerAddressEditingFinished() ) ); this, SLOT ( OnCentralServerAddressEditingFinished() ) );
@ -607,12 +623,6 @@ void CClientSettingsDlg::OnNetBufServerValueChanged ( int value )
UpdateJitterBufferFrame(); UpdateJitterBufferFrame();
} }
void CClientSettingsDlg::OnSliderSndCrdBufferDelay ( int value )
{
pClient->SetSndCrdPrefFrameSizeFactor ( value );
UpdateDisplay();
}
void CClientSettingsDlg::OnSoundcardActivated ( int iSndDevIdx ) void CClientSettingsDlg::OnSoundcardActivated ( int iSndDevIdx )
{ {
const QString strError = pClient->SetSndCrdDev ( iSndDevIdx ); const QString strError = pClient->SetSndCrdDev ( iSndDevIdx );
@ -684,6 +694,12 @@ void CClientSettingsDlg::OnAutoJitBufStateChanged ( int value )
UpdateJitterBufferFrame(); UpdateJitterBufferFrame();
} }
void CClientSettingsDlg::OnEnableOPUS64StateChanged ( int value )
{
pClient->SetEnableOPUS64 ( value == Qt::Checked );
UpdateDisplay();
}
void CClientSettingsDlg::OnGUIDesignFancyStateChanged ( int value ) void CClientSettingsDlg::OnGUIDesignFancyStateChanged ( int value )
{ {
if ( value == Qt::Unchecked ) if ( value == Qt::Unchecked )

View file

@ -87,10 +87,10 @@ protected:
void OnTimerStatus() { UpdateDisplay(); } void OnTimerStatus() { UpdateDisplay(); }
void OnNetBufValueChanged ( int value ); void OnNetBufValueChanged ( int value );
void OnNetBufServerValueChanged ( int value ); void OnNetBufServerValueChanged ( int value );
void OnSliderSndCrdBufferDelay ( int value );
void OnAutoJitBufStateChanged ( int value ); void OnAutoJitBufStateChanged ( int value );
void OnGUIDesignFancyStateChanged ( int value ); void OnGUIDesignFancyStateChanged ( int value );
void OnDisplayChannelLevelsStateChanged ( int value ); void OnDisplayChannelLevelsStateChanged ( int value );
void OnEnableOPUS64StateChanged ( int value );
void OnCentralServerAddressEditingFinished(); void OnCentralServerAddressEditingFinished();
void OnNewClientLevelEditingFinished(); void OnNewClientLevelEditingFinished();
void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button ); void OnSndCrdBufferDelayButtonGroupClicked ( QAbstractButton* button );

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>567</width> <width>575</width>
<height>371</height> <height>394</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -207,6 +207,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QCheckBox" name="chbEnableOPUS64">
<property name="text">
<string>Enable Small Network Buffers</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="grbSoundCrdBufDelay"> <widget class="QGroupBox" name="grbSoundCrdBufDelay">
<property name="title"> <property name="title">
@ -715,6 +722,7 @@
<tabstop>cbxRInChan</tabstop> <tabstop>cbxRInChan</tabstop>
<tabstop>cbxLOutChan</tabstop> <tabstop>cbxLOutChan</tabstop>
<tabstop>cbxROutChan</tabstop> <tabstop>cbxROutChan</tabstop>
<tabstop>chbEnableOPUS64</tabstop>
<tabstop>rbtBufferDelayPreferred</tabstop> <tabstop>rbtBufferDelayPreferred</tabstop>
<tabstop>rbtBufferDelayDefault</tabstop> <tabstop>rbtBufferDelayDefault</tabstop>
<tabstop>rbtBufferDelaySafe</tabstop> <tabstop>rbtBufferDelaySafe</tabstop>

View file

@ -243,6 +243,12 @@ void CSettings::Load()
pClient->SetServerSockBufNumFrames ( iValue ); pClient->SetServerSockBufNumFrames ( iValue );
} }
// enable OPUS64 setting
if ( GetFlagIniSet ( IniXMLDocument, "client", "enableopussmall", bValue ) )
{
pClient->SetEnableOPUS64 ( bValue );
}
// GUI design // GUI design
if ( GetNumericIniSet ( IniXMLDocument, "client", "guidesign", if ( GetNumericIniSet ( IniXMLDocument, "client", "guidesign",
0, 1 /* GD_ORIGINAL */, iValue ) ) 0, 1 /* GD_ORIGINAL */, iValue ) )
@ -531,6 +537,10 @@ void CSettings::Save()
SetNumericIniSet ( IniXMLDocument, "client", "jitbufserver", SetNumericIniSet ( IniXMLDocument, "client", "jitbufserver",
pClient->GetServerSockBufNumFrames() ); pClient->GetServerSockBufNumFrames() );
// enable OPUS64 setting
SetFlagIniSet ( IniXMLDocument, "client", "enableopussmall",
pClient->GetEnableOPUS64() );
// GUI design // GUI design
SetNumericIniSet ( IniXMLDocument, "client", "guidesign", SetNumericIniSet ( IniXMLDocument, "client", "guidesign",
static_cast<int> ( pClient->GetGUIDesign() ) ); static_cast<int> ( pClient->GetGUIDesign() ) );