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
|
||||
iNetwFrameSizeFact = NetworkTransportProps.iBlockSizeFact;
|
||||
iNetwFrameSize =
|
||||
NetworkTransportProps.iNetworkPacketSize /
|
||||
NetworkTransportProps.iBlockSizeFact;
|
||||
NetworkTransportProps.iBaseNetworkPacketSize;
|
||||
|
||||
// update socket buffer (the network block size is a multiple of the
|
||||
// minimum network frame size
|
||||
|
@ -304,7 +303,7 @@ void CChannel::OnReqNetTranspProps()
|
|||
void CChannel::CreateNetTranspPropsMessFromCurrentSettings()
|
||||
{
|
||||
CNetworkTransportProps NetworkTransportProps (
|
||||
iNetwFrameSize * iNetwFrameSizeFact,
|
||||
iNetwFrameSize,
|
||||
iNetwFrameSizeFact,
|
||||
1, // right now we only use mono
|
||||
SYSTEM_SAMPLE_RATE,
|
||||
|
|
|
@ -117,9 +117,9 @@ MESSAGES
|
|||
|
||||
- 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 | ...
|
||||
... ------------------+-----------------------+ ...
|
||||
|
@ -127,7 +127,7 @@ MESSAGES
|
|||
... 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
|
||||
- "num chan": number of channels of the audio signal, e.g. "2" is stereo
|
||||
- "sam rate": sample rate of the audio stream
|
||||
|
@ -827,9 +827,9 @@ void CProtocol::CreateNetwTranspPropsMes ( const CNetworkTransportProps& NetTrPr
|
|||
// build data vector
|
||||
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,
|
||||
static_cast<uint32_t> ( NetTrProps.iNetworkPacketSize ), 4 );
|
||||
static_cast<uint32_t> ( NetTrProps.iBaseNetworkPacketSize ), 4 );
|
||||
|
||||
// block size factor (2 bytes)
|
||||
PutValOnStream ( vecData, iPos,
|
||||
|
@ -874,12 +874,12 @@ bool CProtocol::EvaluateNetwTranspPropsMes ( const CVector<uint8_t>& vecData )
|
|||
return true;
|
||||
}
|
||||
|
||||
// length of the network packet in bytes (4 bytes)
|
||||
ReceivedNetwTranspProps.iNetworkPacketSize =
|
||||
// length of the base network packet (frame) in bytes (4 bytes)
|
||||
ReceivedNetwTranspProps.iBaseNetworkPacketSize =
|
||||
static_cast<uint32_t> ( GetValFromStream ( vecData, iPos, 4 ) );
|
||||
|
||||
if ( ( ReceivedNetwTranspProps.iNetworkPacketSize < 1 ) ||
|
||||
( ReceivedNetwTranspProps.iNetworkPacketSize > MAX_SIZE_BYTES_NETW_BUF ) )
|
||||
if ( ( ReceivedNetwTranspProps.iBaseNetworkPacketSize < 1 ) ||
|
||||
( ReceivedNetwTranspProps.iBaseNetworkPacketSize > MAX_SIZE_BYTES_NETW_BUF ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -447,21 +447,21 @@ class CNetworkTransportProps
|
|||
{
|
||||
public:
|
||||
CNetworkTransportProps() :
|
||||
iNetworkPacketSize ( 0 ),
|
||||
iBaseNetworkPacketSize ( 0 ),
|
||||
iBlockSizeFact ( 0 ),
|
||||
iNumAudioChannels ( 0 ),
|
||||
iSampleRate ( 0 ),
|
||||
eAudioCodingType ( CT_NONE ),
|
||||
iAudioCodingArg ( 0 ) {}
|
||||
|
||||
CNetworkTransportProps ( const uint32_t iNNPS,
|
||||
CNetworkTransportProps ( const uint32_t iNBNPS,
|
||||
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 ),
|
||||
iBaseNetworkPacketSize ( iNBNPS ),
|
||||
iBlockSizeFact ( iNBSF ),
|
||||
iNumAudioChannels ( iNNACH ),
|
||||
iSampleRate ( iNSR ),
|
||||
|
@ -469,7 +469,7 @@ public:
|
|||
iVersion ( iNVers ),
|
||||
iAudioCodingArg ( iNACA ) {}
|
||||
|
||||
uint32_t iNetworkPacketSize;
|
||||
uint32_t iBaseNetworkPacketSize;
|
||||
uint16_t iBlockSizeFact;
|
||||
uint32_t iNumAudioChannels;
|
||||
uint32_t iSampleRate;
|
||||
|
|
Loading…
Reference in a new issue