some code cleanup, introduces one more check in protocol
This commit is contained in:
parent
c064b49576
commit
2efdb7775d
3 changed files with 37 additions and 40 deletions
|
@ -906,19 +906,14 @@ bool CChannel::GetAddress(CHostAddress& RetAddr)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTransportProps )
|
||||
{
|
||||
QMutexLocker locker ( &Mutex );
|
||||
|
||||
// TEST
|
||||
// TODO check possiblity of received parameter -> error checking
|
||||
// utilize, e.g., MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ
|
||||
vecNetwBufferInProps[0].iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize;
|
||||
vecNetwBufferInProps[0].eAudComprType = NetworkTransportProps.eAudioCodingType;
|
||||
vecNetwBufferInProps[0].iNetwInBufSize = AudioCompressionIn.Init (
|
||||
// apply received parameters to internal data struct
|
||||
vecNetwBufferInProps[0].iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize;
|
||||
vecNetwBufferInProps[0].eAudComprType = NetworkTransportProps.eAudioCodingType;
|
||||
vecNetwBufferInProps[0].iNetwInBufSize = AudioCompressionIn.Init (
|
||||
vecNetwBufferInProps[0].iAudioBlockSize,
|
||||
vecNetwBufferInProps[0].eAudComprType );
|
||||
}
|
||||
|
@ -942,9 +937,6 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
|
|||
Protocol.CreateNetwTranspPropsMes ( NetworkTransportProps );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
EPutDataStat CChannel::PutData ( const CVector<unsigned char>& vecbyData,
|
||||
int iNumBytes )
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ void CClient::Start()
|
|||
// init object
|
||||
|
||||
// TEST
|
||||
Init ( 256 );
|
||||
Init ( 192 );
|
||||
|
||||
// enable channel
|
||||
Channel.SetEnable ( true );
|
||||
|
|
|
@ -870,6 +870,11 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
|
|||
ReceivedNetwTranspProps.iMonoAudioBlockSize =
|
||||
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) );
|
||||
|
||||
if ( ReceivedNetwTranspProps.iMonoAudioBlockSize > MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ )
|
||||
{
|
||||
return true; // maximum audio size exceeded, return error
|
||||
}
|
||||
|
||||
// number of channels of the audio signal, e.g. "2" is stereo (1 byte)
|
||||
ReceivedNetwTranspProps.iNumAudioChannels =
|
||||
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 1 ) );
|
||||
|
|
Loading…
Reference in a new issue