reset network transport properties on disconnect of the channel (so that network transport properties must be received for successful decoding)

This commit is contained in:
Volker Fischer 2013-02-12 15:34:26 +00:00
parent 8921fed34c
commit 0bc4bae2a6

View file

@ -30,11 +30,11 @@ CChannel::CChannel ( const bool bNIsServer ) :
vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ), vecdGains ( MAX_NUM_CHANNELS, (double) 1.0 ),
bDoAutoSockBufSize ( true ), bDoAutoSockBufSize ( true ),
bIsEnabled ( false ), bIsEnabled ( false ),
bIsServer ( bNIsServer ), bIsServer ( bNIsServer )
iNetwFrameSizeFact ( FRAME_SIZE_FACTOR_PREFERRED ),
iNetwFrameSize ( 20 ), // must be > 0 and should be close to a valid size
iNumAudioChannels ( 1 ) // mono
{ {
// reset network transport properties
ResetNetworkTransportProperties();
// initial value for connection time out counter, we calculate the total // initial value for connection time out counter, we calculate the total
// number of samples here and subtract the number of samples of the block // number of samples here and subtract the number of samples of the block
// which we take out of the buffer to be independent of block sizes // which we take out of the buffer to be independent of block sizes
@ -440,11 +440,6 @@ EPutDataStat CChannel::PutData ( const CVector<uint8_t>& vecbyData,
{ {
Mutex.lock(); Mutex.lock();
{ {
// TODO only process data if network properties protocol message has been arrived
// only process audio if packet has correct size // only process audio if packet has correct size
if ( iNumBytes == ( iNetwFrameSize * iNetwFrameSizeFact ) ) if ( iNumBytes == ( iNetwFrameSize * iNetwFrameSizeFact ) )
{ {
@ -538,6 +533,9 @@ EGetDataStat CChannel::GetData ( CVector<uint8_t>& vecbyData )
eGetStatus = GS_CHAN_NOW_DISCONNECTED; eGetStatus = GS_CHAN_NOW_DISCONNECTED;
iConTimeOut = 0; // make sure we do not have negative values iConTimeOut = 0; // make sure we do not have negative values
// reset network transport properties
ResetNetworkTransportProperties();
// emit message // emit message
emit Disconnected(); emit Disconnected();
} }