From 961ae0f396a4295b7605e329e329b618fc9bb16e Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 10 Mar 2013 08:19:41 +0000 Subject: [PATCH] fix for loud noise at the beginning of a connection when a new server (supporting OPUS) is connected -> Still some noise left because of weird PLC effects of the OPUS codec --- src/client.h | 18 ++++++++++++++++-- src/clientsettingsdlg.h | 3 ++- src/llconclientdlg.cpp | 4 ++++ src/llconclientdlg.h | 3 +++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/client.h b/src/client.h index 56ab1581..e781ffbb 100755 --- a/src/client.h +++ b/src/client.h @@ -65,18 +65,29 @@ #define AUD_REVERB_MAX 100 // CELT number of coded bytes per audio packet -// 24: mono low/normal quality 156 kbsp (128) / 114 kbps (256) +// 24: mono low/normal quality 156 kbps (128) / 114 kbps (256) // 44: mono high quality 216 kbps (128) / 174 kbps (256) // NOTE: Must be > CELT_MINIMUM_NUM_BYTES (greater, not equal to!) #define CELT_NUM_BYTES_MONO_NORMAL_QUALITY 24 #define CELT_NUM_BYTES_MONO_HIGH_QUALITY 44 -// 46: stereo low/normal quality 222 kbsp (128) / 180 kbps (256) +// 46: stereo low/normal quality 222 kbps (128) / 180 kbps (256) // 70: stereo high quality 294 kbps (128) / 252 kbps (256) #define CELT_NUM_BYTES_STEREO_NORMAL_QUALITY 46 #define CELT_NUM_BYTES_STEREO_HIGH_QUALITY 70 +// OPUS number of coded bytes per audio packet +// TODO we have to use new numbers for OPUS to avoid that old CELT packets +// are used in the OPUS decoder (which gives a bad noise output signal). +// Later on when the CELT is completely removed we could set the OPUS +// numbers back to the original CELT values (to reduce network load) +#define OPUS_NUM_BYTES_MONO_NORMAL_QUALITY 25 +#define OPUS_NUM_BYTES_MONO_HIGH_QUALITY 45 +#define OPUS_NUM_BYTES_STEREO_NORMAL_QUALITY 47 +#define OPUS_NUM_BYTES_STEREO_HIGH_QUALITY 71 + + /* Classes ********************************************************************/ class CClient : public QObject { @@ -364,6 +375,9 @@ signals: int iPingTime, int iNumClients ); void Disconnected(); + +// #### COMPATIBILITY OLD VERSION, TO BE REMOVED #### +void UpstreamRateChanged(); }; #endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */ diff --git a/src/clientsettingsdlg.h b/src/clientsettingsdlg.h index 44e928d3..85b4bbe6 100755 --- a/src/clientsettingsdlg.h +++ b/src/clientsettingsdlg.h @@ -59,6 +59,8 @@ public: const int iOverallDelayMs, const int iOverallDelayLEDColor ); + void UpdateDisplay(); + protected: void UpdateJitterBufferFrame(); void UpdateSoundCardFrame(); @@ -72,7 +74,6 @@ protected: CClient* pClient; QTimer TimerStatus; QButtonGroup SndCrdBufferDelayButtonGroup; - void UpdateDisplay(); public slots: void OnTimerStatus() { UpdateDisplay(); } diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 38201a83..8547d8b4 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -439,6 +439,10 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, SIGNAL ( CLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ), this, SLOT ( OnCLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ) ); + QObject::connect ( pClient, + SIGNAL ( UpstreamRateChanged() ), + this, SLOT ( OnUpstreamRateChanged() ) ); + QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ), this, SLOT ( OnAboutToQuit() ) ); diff --git a/src/llconclientdlg.h b/src/llconclientdlg.h index 22c648de..881d6f36 100755 --- a/src/llconclientdlg.h +++ b/src/llconclientdlg.h @@ -167,6 +167,9 @@ public slots: void OnDisconnected(); + void OnUpstreamRateChanged() + { ClientSettingsDlg.UpdateDisplay(); } + void OnGUIDesignChanged() { SetGUIDesign ( pClient->GetGUIDesign() ); }