use network base frame size in protocol instead of acutal network packet size
This commit is contained in:
parent
e354d985bc
commit
1a42d2bf0e
3 changed files with 1673 additions and 1674 deletions
|
@ -284,8 +284,7 @@ void CChannel::OnNetTranspPropsReceived ( CNetworkTransportProps NetworkTranspor
|
||||||
// store received parameters
|
// store received parameters
|
||||||
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
|
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
|
||||||
iNetwFrameSize =
|
iNetwFrameSize =
|
||||||
NetworkTransportProps.iNetworkPacketSize /
|
NetworkTransportProps.iBaseNetworkPacketSize;
|
||||||
NetworkTransportProps.iBlockSizeFact;
|
|
||||||
|
|
||||||
// update socket buffer (the network block size is a multiple of the
|
// update socket buffer (the network block size is a multiple of the
|
||||||
// minimum network frame size
|
// minimum network frame size
|
||||||
|
@ -304,7 +303,7 @@ void CChannel::OnReqNetTranspProps()
|
||||||
void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
|
void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
|
||||||
{
|
{
|
||||||
CNetworkTransportProps NetworkTransportProps (
|
CNetworkTransportProps NetworkTransportProps (
|
||||||
iNetwFrameSize * iNetwFrameSizeFact,
|
iNetwFrameSize,
|
||||||
iNetwFrameSizeFact,
|
iNetwFrameSizeFact,
|
||||||
1, // right now we only use mono
|
1, // right now we only use mono
|
||||||
SYSTEM_SAMPLE_RATE,
|
SYSTEM_SAMPLE_RATE,
|
||||||
|
|
|
@ -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 | 2 bytes block size fact | 1 byte num chan | ...
|
| 4 bytes base 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 | ...
|
||||||
... ------------------+-----------------------+ ...
|
... ------------------+-----------------------+ ...
|
||||||
|
@ -127,7 +127,7 @@ MESSAGES
|
||||||
... 2 bytes version | 4 bytes audiocod arg |
|
... 2 bytes version | 4 bytes audiocod arg |
|
||||||
... -----------------+----------------------+
|
... -----------------+----------------------+
|
||||||
|
|
||||||
- "netw size": length of the network packet in bytes
|
- "base netw size": length of the base network packet (frame) in bytes
|
||||||
- "block size fact": block size factor
|
- "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
|
||||||
|
@ -827,9 +827,9 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
|
||||||
// build data vector
|
// build data vector
|
||||||
CVector<uint8_t> vecData ( iEntrLen );
|
CVector<uint8_t> vecData ( iEntrLen );
|
||||||
|
|
||||||
// length of the network packet in bytes (4 bytes)
|
// length of the base network packet (frame) in bytes (4 bytes)
|
||||||
PutValOnStream ( vecData, iPos,
|
PutValOnStream ( vecData, iPos,
|
||||||
static_cast<uint32_t> ( NetTrProps.iNetworkPacketSize ), 4 );
|
static_cast<uint32_t> ( NetTrProps.iBaseNetworkPacketSize ), 4 );
|
||||||
|
|
||||||
// block size factor (2 bytes)
|
// block size factor (2 bytes)
|
||||||
PutValOnStream ( vecData, iPos,
|
PutValOnStream ( vecData, iPos,
|
||||||
|
@ -874,12 +874,12 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// length of the network packet in bytes (4 bytes)
|
// length of the base network packet (frame) in bytes (4 bytes)
|
||||||
ReceivedNetwTranspProps.iNetworkPacketSize =
|
ReceivedNetwTranspProps.iBaseNetworkPacketSize =
|
||||||
static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
|
static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
|
||||||
|
|
||||||
if ( ( ReceivedNetwTranspProps.iNetworkPacketSize < 1 ) ||
|
if ( ( ReceivedNetwTranspProps.iBaseNetworkPacketSize < 1 ) ||
|
||||||
( ReceivedNetwTranspProps.iNetworkPacketSize > MAX_SIZE_BYTES_NETW_BUF ) )
|
( ReceivedNetwTranspProps.iBaseNetworkPacketSize > MAX_SIZE_BYTES_NETW_BUF ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -447,21 +447,21 @@ class CNetworkTransportProps
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CNetworkTransportProps() :
|
CNetworkTransportProps() :
|
||||||
iNetworkPacketSize ( 0 ),
|
iBaseNetworkPacketSize ( 0 ),
|
||||||
iBlockSizeFact ( 0 ),
|
iBlockSizeFact ( 0 ),
|
||||||
iNumAudioChannels ( 0 ),
|
iNumAudioChannels ( 0 ),
|
||||||
iSampleRate ( 0 ),
|
iSampleRate ( 0 ),
|
||||||
eAudioCodingType ( CT_NONE ),
|
eAudioCodingType ( CT_NONE ),
|
||||||
iAudioCodingArg ( 0 ) {}
|
iAudioCodingArg ( 0 ) {}
|
||||||
|
|
||||||
CNetworkTransportProps ( const uint32_t iNNPS,
|
CNetworkTransportProps ( const uint32_t iNBNPS,
|
||||||
const uint16_t iNBSF,
|
const uint16_t iNBSF,
|
||||||
const uint32_t iNNACH,
|
const uint32_t iNNACH,
|
||||||
const uint32_t iNSR,
|
const uint32_t iNSR,
|
||||||
const EAudComprType eNACT,
|
const EAudComprType eNACT,
|
||||||
const uint32_t iNVers,
|
const uint32_t iNVers,
|
||||||
const int32_t iNACA ) :
|
const int32_t iNACA ) :
|
||||||
iNetworkPacketSize ( iNNPS ),
|
iBaseNetworkPacketSize ( iNBNPS ),
|
||||||
iBlockSizeFact ( iNBSF ),
|
iBlockSizeFact ( iNBSF ),
|
||||||
iNumAudioChannels ( iNNACH ),
|
iNumAudioChannels ( iNNACH ),
|
||||||
iSampleRate ( iNSR ),
|
iSampleRate ( iNSR ),
|
||||||
|
@ -469,7 +469,7 @@ public:
|
||||||
iVersion ( iNVers ),
|
iVersion ( iNVers ),
|
||||||
iAudioCodingArg ( iNACA ) {}
|
iAudioCodingArg ( iNACA ) {}
|
||||||
|
|
||||||
uint32_t iNetworkPacketSize;
|
uint32_t iBaseNetworkPacketSize;
|
||||||
uint16_t iBlockSizeFact;
|
uint16_t iBlockSizeFact;
|
||||||
uint32_t iNumAudioChannels;
|
uint32_t iNumAudioChannels;
|
||||||
uint32_t iSampleRate;
|
uint32_t iSampleRate;
|
||||||
|
|
Loading…
Add table
Reference in a new issue