changed one protocol message

This commit is contained in:
Volker Fischer 2009-07-25 21:42:02 +00:00
parent 572dcd8728
commit 60482269ed
4 changed files with 43 additions and 48 deletions

View File

@ -814,7 +814,7 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
QMutexLocker locker ( &Mutex ); QMutexLocker locker ( &Mutex );
// apply received parameters to internal data struct // apply received parameters to internal data struct
NetwBufferInProps.iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize; // NetwBufferInProps.iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize;
NetwBufferInProps.iNetwInBufSize = NetworkTransportProps.iNetworkPacketSize; NetwBufferInProps.iNetwInBufSize = NetworkTransportProps.iNetworkPacketSize;
// re-initialize cycle time variance measurement if necessary // re-initialize cycle time variance measurement if necessary
@ -853,7 +853,7 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
iAudComprSizeOut, iAudComprSizeOut,
0, // TODO 0, // TODO
1, // right now we only use mono 1, // right now we only use mono
SYSTEM_SAMPLE_RATE, // right now only one sample rate is supported SYSTEM_SAMPLE_RATE,
CT_CELT, // always CELT coding CT_CELT, // always CELT coding
0, 0,
0 ); 0 );
@ -979,13 +979,11 @@ EGetDataStat CChannel::GetData ( CVector<uint8_t>& vecbyData )
// decrease time-out counter // decrease time-out counter
if ( iConTimeOut > 0 ) if ( iConTimeOut > 0 )
{ {
// TODO
// subtract the number of samples of the current block since the // subtract the number of samples of the current block since the
// time out counter is based on samples not on blocks // time out counter is based on samples not on blocks (definition:
iConTimeOut -= vecbyData.Size(); // always one atomic block is get by using the GetData() function
// where the atomic block size is "SYSTEM_BLOCK_SIZE_SAMPLES")
iConTimeOut -= SYSTEM_BLOCK_SIZE_SAMPLES;
if ( iConTimeOut <= 0 ) if ( iConTimeOut <= 0 )
{ {

View File

@ -117,11 +117,13 @@
#elif HAVE_INTTYPES_H #elif HAVE_INTTYPES_H
# include <inttypes.h> # include <inttypes.h>
#elif defined ( _WIN32 ) #elif defined ( _WIN32 )
typedef __int32 int32_t;
typedef __int16 int16_t; typedef __int16 int16_t;
typedef unsigned __int32 uint32_t; typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t; typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t; typedef unsigned __int8 uint8_t;
#else #else
typedef int int32_t;
typedef short int16_t; typedef short int16_t;
typedef unsigned int uint32_t; typedef unsigned int uint32_t;
typedef unsigned short uint16_t; typedef unsigned short uint16_t;

View File

@ -117,9 +117,9 @@ MESSAGES
- Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS - Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS
+-------------------+------------------+-----------------+ ... +-------------------+-------------------------+-----------------+ ...
| 4 bytes netw size | 4 bytes aud size | 1 byte num chan | ... | 4 bytes netw size | 2 bytes block size fact | 1 byte num chan | ...
+-------------------+------------------+-----------------+ ... +-------------------+-------------------------+-----------------+ ...
... ------------------+-----------------------+ ... ... ------------------+-----------------------+ ...
... 4 bytes sam rate | 2 bytes audiocod type | ... ... 4 bytes sam rate | 2 bytes audiocod type | ...
... ------------------+-----------------------+ ... ... ------------------+-----------------------+ ...
@ -128,7 +128,7 @@ MESSAGES
... -----------------+----------------------+ ... -----------------+----------------------+
- "netw size": length of the network packet in bytes - "netw size": length of the network packet in bytes
- "aud size": length of the mono audio block size in samples - "block size fact": block size factor
- "num chan": number of channels of the audio signal, e.g. "2" is stereo - "num chan": number of channels of the audio signal, e.g. "2" is stereo
- "sam rate": sample rate of the audio stream - "sam rate": sample rate of the audio stream
- "audiocod type": audio coding type, the following types are supported: - "audiocod type": audio coding type, the following types are supported:
@ -820,7 +820,7 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
unsigned int iPos = 0; // init position pointer unsigned int iPos = 0; // init position pointer
// size of current message body // size of current message body
const int iEntrLen = 4 /* netw size */ + 4 /* aud size */ + const int iEntrLen = 4 /* netw size */ + 2 /* block size fact */ +
1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ + 1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ +
2 /* version */ + 4 /* audiocod arg */; 2 /* version */ + 4 /* audiocod arg */;
@ -831,9 +831,9 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( NetTrProps.iNetworkPacketSize ), 4 ); static_cast<uint32_t> ( NetTrProps.iNetworkPacketSize ), 4 );
// length of the mono audio block size in samples (4 bytes) // block size factor (2 bytes)
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( NetTrProps.iMonoAudioBlockSize ), 4 ); static_cast<uint32_t> ( NetTrProps.iBlockSizeFact ), 2 );
// number of channels of the audio signal, e.g. "2" is stereo (1 byte) // number of channels of the audio signal, e.g. "2" is stereo (1 byte)
PutValOnStream ( vecData, iPos, PutValOnStream ( vecData, iPos,
@ -864,7 +864,7 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
CNetworkTransportProps ReceivedNetwTranspProps; CNetworkTransportProps ReceivedNetwTranspProps;
// size of current message body // size of current message body
const int iEntrLen = 4 /* netw size */ + 4 /* aud size */ + const int iEntrLen = 4 /* netw size */ + 2 /* block size fact */ +
1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ + 1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ +
2 /* version */ + 4 /* audiocod arg */; 2 /* version */ + 4 /* audiocod arg */;
@ -876,24 +876,19 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
// length of the network packet in bytes (4 bytes) // length of the network packet in bytes (4 bytes)
ReceivedNetwTranspProps.iNetworkPacketSize = ReceivedNetwTranspProps.iNetworkPacketSize =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) ); static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
// length of the mono audio block size in samples (4 bytes) // block size factor (2 bytes)
ReceivedNetwTranspProps.iMonoAudioBlockSize = ReceivedNetwTranspProps.iBlockSizeFact =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) ); static_cast<uint16_t> ( GetValFromStream ( vecData, iPos, 2 ) );
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) // number of channels of the audio signal, e.g. "2" is stereo (1 byte)
ReceivedNetwTranspProps.iNumAudioChannels = ReceivedNetwTranspProps.iNumAudioChannels =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 1 ) ); static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 1 ) );
// sample rate of the audio stream (4 bytes) // sample rate of the audio stream (4 bytes)
ReceivedNetwTranspProps.iSampleRate = ReceivedNetwTranspProps.iSampleRate =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) ); static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
// audio coding type (2 bytes) with error check // audio coding type (2 bytes) with error check
const int iRecCodingType = const int iRecCodingType =
@ -910,11 +905,11 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
// version (2 bytes) // version (2 bytes)
ReceivedNetwTranspProps.iVersion = ReceivedNetwTranspProps.iVersion =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 2 ) ); static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 2 ) );
// argument for the audio coder (4 bytes) // argument for the audio coder (4 bytes)
ReceivedNetwTranspProps.iAudioCodingArg = ReceivedNetwTranspProps.iAudioCodingArg =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) ); static_cast<int32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
// invoke message action // invoke message action
emit NetTranspPropsReceived ( ReceivedNetwTranspProps ); emit NetTranspPropsReceived ( ReceivedNetwTranspProps );

View File

@ -422,25 +422,25 @@ enum EAudComprType
class CNetworkTransportProps class CNetworkTransportProps
{ {
public: public:
CNetworkTransportProps() : iNetworkPacketSize ( 0 ), iMonoAudioBlockSize ( 0 ), CNetworkTransportProps() : iNetworkPacketSize ( 0 ), iBlockSizeFact ( 0 ),
iNumAudioChannels ( 0 ), iSampleRate ( 0 ), iNumAudioChannels ( 0 ), iSampleRate ( 0 ),
eAudioCodingType ( CT_NONE ), iAudioCodingArg ( 0 ) {} eAudioCodingType ( CT_NONE ), iAudioCodingArg ( 0 ) {}
CNetworkTransportProps ( const unsigned int iNNPS, const unsigned int iNMABS, CNetworkTransportProps ( const uint32_t iNNPS, const uint16_t iNBSF,
const unsigned int iNNACH, const unsigned int iNSR, const uint32_t iNNACH, const uint32_t iNSR,
const EAudComprType eNACT, const unsigned int iNVers, const int iNACA ) : const EAudComprType eNACT, const uint32_t iNVers, const int32_t iNACA ) :
iNetworkPacketSize ( iNNPS ), iMonoAudioBlockSize ( iNMABS ), iNetworkPacketSize ( iNNPS ), iBlockSizeFact ( iNBSF ),
iNumAudioChannels ( iNNACH ), iSampleRate ( iNSR ), iNumAudioChannels ( iNNACH ), iSampleRate ( iNSR ),
eAudioCodingType ( eNACT ), iVersion ( iNVers ), eAudioCodingType ( eNACT ), iVersion ( iNVers ),
iAudioCodingArg ( iNACA ) {} iAudioCodingArg ( iNACA ) {}
unsigned int iNetworkPacketSize; uint32_t iNetworkPacketSize;
unsigned int iMonoAudioBlockSize; uint16_t iBlockSizeFact;
unsigned int iNumAudioChannels; uint32_t iNumAudioChannels;
unsigned int iSampleRate; uint32_t iSampleRate;
EAudComprType eAudioCodingType; EAudComprType eAudioCodingType;
unsigned int iVersion; uint32_t iVersion;
int iAudioCodingArg; int32_t iAudioCodingArg;
}; };
class CSndCrdBufferSizes class CSndCrdBufferSizes