fixed loud noise on initialial connection (caused by weird OPUS PLC effect)

This commit is contained in:
Volker Fischer 2013-03-10 09:27:25 +00:00
parent 961ae0f396
commit ccadb45f11
2 changed files with 12 additions and 2 deletions

View file

@ -36,6 +36,7 @@ CClient::CClient ( const quint16 iPortNumber ) :
iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ), iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ),
bCeltDoHighQuality ( false ), bCeltDoHighQuality ( false ),
bUseStereo ( false ), bUseStereo ( false ),
bIsInitializationPhase ( true ),
Socket ( &Channel, &ConnLessProtocol, iPortNumber ), Socket ( &Channel, &ConnLessProtocol, iPortNumber ),
Sound ( AudioCallback, this ), Sound ( AudioCallback, this ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
@ -804,6 +805,9 @@ void CClient::Init()
iSndCrdFrameSizeFactor, iSndCrdFrameSizeFactor,
1 ); 1 );
} }
// reset initialization phase flag
bIsInitializationPhase = true;
} }
void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg ) void CClient::AudioCallback ( CVector<int16_t>& psData, void* arg )
@ -1066,6 +1070,10 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
// CELT decoding // CELT decoding
if ( bReceiveDataOk ) if ( bReceiveDataOk )
{ {
// on any valid received packet, we clear the initialization phase
// flag
bIsInitializationPhase = false;
if ( bUseStereo ) if ( bUseStereo )
{ {
if ( eAudioCompressionType == CT_CELT ) if ( eAudioCompressionType == CT_CELT )
@ -1160,8 +1168,9 @@ fflush(pFileDelay);
*/ */
// check if channel is connected // check if channel is connected and if we do not have the initialization
if ( Channel.IsConnected() ) // phase
if ( Channel.IsConnected() && ( !bIsInitializationPhase ) )
{ {
if ( !bUseStereo ) if ( !bUseStereo )
{ {

View file

@ -298,6 +298,7 @@ void SetAudoCompressiontype ( const EAudComprType eNAudCompressionType );
int iCeltNumCodedBytes; int iCeltNumCodedBytes;
bool bCeltDoHighQuality; bool bCeltDoHighQuality;
bool bUseStereo; bool bUseStereo;
bool bIsInitializationPhase;
CVector<unsigned char> vecCeltData; CVector<unsigned char> vecCeltData;
CSocket Socket; CSocket Socket;