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 );
// apply received parameters to internal data struct
NetwBufferInProps.iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize;
// NetwBufferInProps.iAudioBlockSize = NetworkTransportProps.iMonoAudioBlockSize;
NetwBufferInProps.iNetwInBufSize = NetworkTransportProps.iNetworkPacketSize;
// re-initialize cycle time variance measurement if necessary
@ -853,7 +853,7 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
iAudComprSizeOut,
0, // TODO
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
0,
0 );
@ -979,13 +979,11 @@ EGetDataStat CChannel::GetData ( CVector<uint8_t>& vecbyData )
// decrease time-out counter
if ( iConTimeOut > 0 )
{
// TODO
// subtract the number of samples of the current block since the
// time out counter is based on samples not on blocks
iConTimeOut -= vecbyData.Size();
// time out counter is based on samples not on blocks (definition:
// 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 )
{

View File

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

View File

@ -117,9 +117,9 @@ MESSAGES
- 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 | ...
... ------------------+-----------------------+ ...
@ -127,15 +127,15 @@ MESSAGES
... 2 bytes version | 4 bytes audiocod arg |
... -----------------+----------------------+
- "netw size": length of the network packet in bytes
- "aud size": length of the mono audio block size in samples
- "num chan": number of channels of the audio signal, e.g. "2" is stereo
- "sam rate": sample rate of the audio stream
- "audiocod type": audio coding type, the following types are supported:
- 0: none, no audio coding applied
- 1: CELT
- "version": version of the audio coder, if not used this value shall be set to 0
- "audiocod arg": argument for the audio coder, if not used this value shall be set to 0
- "netw size": length of the network packet in bytes
- "block size fact": block size factor
- "num chan": number of channels of the audio signal, e.g. "2" is stereo
- "sam rate": sample rate of the audio stream
- "audiocod type": audio coding type, the following types are supported:
- 0: none, no audio coding applied
- 1: CELT
- "version": version of the audio coder, if not used this value shall be set to 0
- "audiocod arg": argument for the audio coder, if not used this value shall be set to 0
- Request properties for network transport: PROTMESSID_REQ_NETW_TRANSPORT_PROPS
@ -820,7 +820,7 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
unsigned int iPos = 0; // init position pointer
// 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 */ +
2 /* version */ + 4 /* audiocod arg */;
@ -831,9 +831,9 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
PutValOnStream ( vecData, iPos,
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,
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)
PutValOnStream ( vecData, iPos,
@ -864,7 +864,7 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
CNetworkTransportProps ReceivedNetwTranspProps;
// 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 */ +
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)
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)
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
}
// block size factor (2 bytes)
ReceivedNetwTranspProps.iBlockSizeFact =
static_cast<uint16_t> ( GetValFromStream ( vecData, iPos, 2 ) );
// number of channels of the audio signal, e.g. "2" is stereo (1 byte)
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)
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
const int iRecCodingType =
@ -910,11 +905,11 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
// version (2 bytes)
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)
ReceivedNetwTranspProps.iAudioCodingArg =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) );
static_cast<int32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
// invoke message action
emit NetTranspPropsReceived ( ReceivedNetwTranspProps );

View File

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