diff --git a/src/client.cpp b/src/client.cpp index 997736e5..c3a182c8 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -36,6 +36,7 @@ CClient::CClient ( const quint16 iPortNumber ) : iCeltNumCodedBytes ( CELT_NUM_BYTES_MONO_NORMAL_QUALITY ), bCeltDoHighQuality ( false ), bUseStereo ( false ), + bIsInitializationPhase ( true ), Socket ( &Channel, &ConnLessProtocol, iPortNumber ), Sound ( AudioCallback, this ), iAudioInFader ( AUD_FADER_IN_MIDDLE ), @@ -804,6 +805,9 @@ void CClient::Init() iSndCrdFrameSizeFactor, 1 ); } + + // reset initialization phase flag + bIsInitializationPhase = true; } void CClient::AudioCallback ( CVector& psData, void* arg ) @@ -1066,6 +1070,10 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) // CELT decoding if ( bReceiveDataOk ) { + // on any valid received packet, we clear the initialization phase + // flag + bIsInitializationPhase = false; + if ( bUseStereo ) { if ( eAudioCompressionType == CT_CELT ) @@ -1160,8 +1168,9 @@ fflush(pFileDelay); */ - // check if channel is connected - if ( Channel.IsConnected() ) + // check if channel is connected and if we do not have the initialization + // phase + if ( Channel.IsConnected() && ( !bIsInitializationPhase ) ) { if ( !bUseStereo ) { diff --git a/src/client.h b/src/client.h index e781ffbb..2d65ef37 100755 --- a/src/client.h +++ b/src/client.h @@ -298,6 +298,7 @@ void SetAudoCompressiontype ( const EAudComprType eNAudCompressionType ); int iCeltNumCodedBytes; bool bCeltDoHighQuality; bool bUseStereo; + bool bIsInitializationPhase; CVector vecCeltData; CSocket Socket;