added version in network properties protocol message

This commit is contained in:
Volker Fischer 2009-07-25 05:57:27 +00:00
parent f53d28fc11
commit 16baee490a
4 changed files with 43 additions and 22 deletions

View File

@ -3,8 +3,6 @@ bin_PROGRAMS = llcon
llcon_SOURCES = ../src/buffer.cpp \
../src/main.cpp \
../src/socket.cpp \
../src/audiocompr.cpp \
../src/resample.cpp \
../src/channel.cpp \
../src/util.cpp \
../src/llconclientdlg.cpp \
@ -24,9 +22,6 @@ llcon_SOURCES = ../src/buffer.cpp \
../src/buffer.h \
../src/global.h \
../src/socket.h \
../src/audiocompr.h \
../src/resample.h \
../src/resamplefilter.h \
../src/channel.h \
../src/util.h \
../src/client.h \

View File

@ -844,6 +844,7 @@ void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
1, // right now we only use mono
SYSTEM_SAMPLE_RATE, // right now only one sample rate is supported
CT_CELT, // always CELT coding
0,
0 );
// send current network transport properties

View File

@ -15,9 +15,12 @@ Protocol message definition
MAIN FRAME
----------
+-------------+------------+------------+------------------+--------------+-------------+
| 2 bytes TAG | 2 bytes ID | 1 byte cnt | 2 bytes length n | n bytes data | 2 bytes CRC |
+-------------+------------+------------+------------------+--------------+-------------+
+-------------+------------+------------+------------------+ ...
| 2 bytes TAG | 2 bytes ID | 1 byte cnt | 2 bytes length n | ...
+-------------+------------+------------+------------------+ ...
... --------------+-------------+
... n bytes data | 2 bytes CRC |
... --------------+-------------+
- TAG is an all zero bit word to identify protocol messages
- message ID defined by the defines PROTMESSID_x
@ -77,10 +80,12 @@ MESSAGES
for each connected client append following data:
+-------------------+--------------------+------------------+----------------------+
| 1 byte channel ID | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string |
+-------------------+--------------------+------------------+----------------------+
+-------------------+--------------------+------------------+ ...
| 1 byte channel ID | 4 bytes IP address | 2 bytes number n | ...
+-------------------+--------------------+------------------+ ...
... ----------------------+
... n bytes UTF-8 string |
... ----------------------+
- Request connected clients list: PROTMESSID_REQ_CONN_CLIENTS_LIST
@ -112,9 +117,15 @@ MESSAGES
- Properties for network transport: PROTMESSID_NETW_TRANSPORT_PROPS
+-------------------+------------------+-----------------+------------------+-----------------------+----------------------+
| 4 bytes netw size | 4 bytes aud size | 1 byte num chan | 4 bytes sam rate | 2 bytes audiocod type | 4 bytes audiocod arg |
+-------------------+------------------+-----------------+------------------+-----------------------+----------------------+
+-------------------+------------------+-----------------+ ...
| 4 bytes netw size | 4 bytes aud size | 1 byte num chan | ...
+-------------------+------------------+-----------------+ ...
... ------------------+-----------------------+ ...
... 4 bytes sam rate | 2 bytes audiocod type | ...
... ------------------+-----------------------+ ...
... -----------------+----------------------+
... 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
@ -125,6 +136,7 @@ MESSAGES
- 1: IMA-ADPCM
- 2: MS-ADPCM
- 3: 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
@ -810,8 +822,9 @@ 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 */ + 1 /* num chan */ +
4 /* sam rate */ + 2 /* audiocod type */ + 4 /* audiocod arg */;
const int iEntrLen = 4 /* netw size */ + 4 /* aud size */ +
1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ +
2 /* version */ + 4 /* audiocod arg */;
// build data vector
CVector<uint8_t> vecData ( iEntrLen );
@ -836,6 +849,10 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( NetTrProps.eAudioCodingType ), 2 );
// version (2 bytes)
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( NetTrProps.iVersion ), 2 );
// argument for the audio coder (4 bytes)
PutValOnStream ( vecData, iPos,
static_cast<uint32_t> ( NetTrProps.iAudioCodingArg ), 4 );
@ -849,8 +866,9 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
CNetworkTransportProps ReceivedNetwTranspProps;
// size of current message body
const int iEntrLen = 4 /* netw size */ + 4 /* aud size */ + 1 /* num chan */ +
4 /* sam rate */ + 2 /* audiocod type */ + 4 /* audiocod arg */;
const int iEntrLen = 4 /* netw size */ + 4 /* aud size */ +
1 /* num chan */ + 4 /* sam rate */ + 2 /* audiocod type */ +
2 /* version */ + 4 /* audiocod arg */;
// check size
if ( vecData.Size() != iEntrLen )
@ -885,7 +903,8 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
if ( ( iRecCodingType != CT_NONE ) &&
( iRecCodingType != CT_IMAADPCM ) &&
( iRecCodingType != CT_MSADPCM ) )
( iRecCodingType != CT_MSADPCM ) &&
( iRecCodingType != CT_CELT ) )
{
return true;
}
@ -893,6 +912,10 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
ReceivedNetwTranspProps.eAudioCodingType =
static_cast<EAudComprType> ( iRecCodingType );
// version (2 bytes)
ReceivedNetwTranspProps.iVersion =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 2 ) );
// argument for the audio coder (4 bytes)
ReceivedNetwTranspProps.iAudioCodingArg =
static_cast<unsigned int> ( GetValFromStream ( vecData, iPos, 4 ) );

View File

@ -430,9 +430,10 @@ public:
CNetworkTransportProps ( const unsigned int iNNPS, const unsigned int iNMABS,
const unsigned int iNNACH, const unsigned int iNSR,
const EAudComprType eNACT, const int iNACA ) :
const EAudComprType eNACT, const unsigned int iNVers, const int iNACA ) :
iNetworkPacketSize ( iNNPS ), iMonoAudioBlockSize ( iNMABS ),
iNumAudioChannels ( iNNACH ), iSampleRate ( iNSR ), eAudioCodingType ( eNACT ),
iNumAudioChannels ( iNNACH ), iSampleRate ( iNSR ),
eAudioCodingType ( eNACT ), iVersion ( iNVers ),
iAudioCodingArg ( iNACA ) {}
unsigned int iNetworkPacketSize;
@ -440,6 +441,7 @@ public:
unsigned int iNumAudioChannels;
unsigned int iSampleRate;
EAudComprType eAudioCodingType;
unsigned int iVersion;
int iAudioCodingArg;
};