added upstream rate calculation

This commit is contained in:
Volker Fischer 2009-03-03 22:46:36 +00:00
parent 2e81acfc3d
commit 78d518bf75
5 changed files with 28 additions and 1 deletions

View file

@ -1153,3 +1153,23 @@ CVector<unsigned char> CChannel::PrepSendPacket ( const CVector<short>& vecsNPac
return vecbySendBuf;
}
int CChannel::GetUploadRateKbps()
{
int iAudioSizeOut;
if ( bIsServer )
{
iAudioSizeOut = iCurNetwOutBlSiFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
}
else
{
iAudioSizeOut = iCurAudioBlockSizeOut;
}
// we assume that the UDP packet which is transported via IP has an
// additional header size of
// 8 (UDP) + 20 (IP without optional fields) = 28 bytes
return ( iAudComprSizeOut + 28 /* header */ ) * 8 /* bits per byte */ *
SYSTEM_SAMPLE_RATE / iAudioSizeOut / 1000;
}

View file

@ -114,6 +114,7 @@ public:
int GetNetwBufSizeOut() { return iCurAudioBlockSizeOut; }
int GetAudioBlockSizeIn() { return iCurAudioBlockSizeIn; }
int GetUploadRateKbps();
void SetNetwBufSizeFactOut ( const int iNewNetwBlSiFactOut );
int GetNetwBufSizeFactOut() { return iCurNetwOutBlSiFact; }

View file

@ -116,6 +116,7 @@ public:
int GetNetwBufSizeOut() { return Channel.GetNetwBufSizeOut(); }
int GetAudioBlockSizeIn() { return Channel.GetAudioBlockSizeIn(); }
int GetUploadRateKbps() { return Channel.GetUploadRateKbps(); }
void SetAudioCompressionOut ( const EAudComprType eNewAudComprTypeOut )
{

View file

@ -321,6 +321,11 @@ void CClientSettingsDlg::UpdateDisplay()
// update slider controls (settings might have been changed)
UpdateJitterBufferFrame();
// TEST
TextUpstreamValue->setText ( QString().setNum ( pClient->GetUploadRateKbps() ) + " kbps" );
if ( !pClient->IsRunning() )
{
// clear text labels with client parameters

View file

@ -463,7 +463,7 @@
<item>
<widget class="QLabel" name="TextUpstream" >
<property name="text" >
<string>Upstream</string>
<string>Upstream Rate</string>
</property>
</widget>
</item>