added overall delay measurement

This commit is contained in:
Volker Fischer 2008-10-31 22:24:05 +00:00
parent 8d77d11ff9
commit b807d001de
2 changed files with 216 additions and 168 deletions

View file

@ -58,12 +58,14 @@ CClientSettingsDlg::CClientSettingsDlg ( CClient* pNCliP, QWidget* parent,
GroupBoxNetwBuf->setWhatsThis ( strNetwBlockSize );
// init timing jitter text label
TextLabelStdDevTimer->setText ( "" );
//TextLabelStdDevTimer->setText ( "" );
// ping time controls
CLEDPingTime->SetUpdateTime ( 2 * PING_UPDATE_TIME );
CLEDPingTime->Reset();
// init delay information controls
CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME );
CLEDOverallDelay->Reset();
TextLabelPingTime->setText ( "" );
TextLabelBufferDelay->setText ( "" );
TextLabelOverallDelay->setText ( "" );
// init slider controls ---
// sound buffer in
@ -291,23 +293,50 @@ void CClientSettingsDlg::OnTimerPing()
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime )
{
// color definition: < 27 ms green, < 50 ms yellow, otherwise red
if ( iPingTime < 27 )
/*
For estimating the overall delay, use the following assumptions:
- the mean delay of a cyclic buffer is half the buffer size (since
for the average it is assumed that the buffer is half filled)
- consider the jitter buffer on the server side, too
- assume that the sound card introduces an additional delay of 2 * MIN_BLOCK_DURATION_MS
*/
const int iTotalJitterBufferDelayMS = MIN_BLOCK_DURATION_MS *
( 2 * pClient->GetSockBufSize() + pClient->GetNetwBufSizeFactIn() +
pClient->GetNetwBufSizeFactOut() ) / 2;
const int iTotalSoundCardDelayMS = 2 * MIN_BLOCK_DURATION_MS +
MIN_BLOCK_DURATION_MS * ( pClient->GetSndInterface()->GetInNumBuf() +
pClient->GetSndInterface()->GetOutNumBuf() ) / 2;
const int iDelayToFillNetworkPackets = MIN_BLOCK_DURATION_MS *
( pClient->GetNetwBufSizeFactIn() + pClient->GetNetwBufSizeFactOut() );
const int iTotalBufferDelay = iDelayToFillNetworkPackets +
iTotalJitterBufferDelayMS + iTotalSoundCardDelayMS;
const int iOverallDelay = iTotalBufferDelay + iPingTime;
// apply values to GUI labels
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
TextLabelBufferDelay->setText ( QString().setNum ( iTotalBufferDelay ) + " ms" );
TextLabelOverallDelay->setText ( QString().setNum ( iOverallDelay ) + " ms" );
// color definition: < 40 ms green, < 60 ms yellow, otherwise red
if ( iOverallDelay <= 40 )
{
CLEDPingTime->SetLight ( MUL_COL_LED_GREEN );
CLEDOverallDelay->SetLight ( MUL_COL_LED_GREEN );
}
else
{
if ( iPingTime < 50 )
if ( iOverallDelay <= 60 )
{
CLEDPingTime->SetLight ( MUL_COL_LED_YELLOW );
CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
}
else
{
CLEDPingTime->SetLight ( MUL_COL_LED_RED );
CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
}
}
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
}
void CClientSettingsDlg::UpdateDisplay()
@ -315,14 +344,16 @@ void CClientSettingsDlg::UpdateDisplay()
if ( pClient->IsRunning() )
{
// response time
TextLabelStdDevTimer->setText ( QString().
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
//TextLabelStdDevTimer->setText ( QString().
// setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
}
else
{
// clear text labels with client parameters
TextLabelStdDevTimer->setText ( "" );
//TextLabelStdDevTimer->setText ( "" );
TextLabelPingTime->setText ( "" );
TextLabelBufferDelay->setText ( "" );
TextLabelOverallDelay->setText ( "" );
}
}
@ -346,15 +377,11 @@ void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
CLEDNetwGet->SetLight ( iStatus );
break;
case MS_PROTOCOL:
CLEDProtocolStatus->SetLight ( iStatus );
case MS_RESET_ALL:
CLEDSoundIn->Reset();
CLEDSoundOut->Reset();
CLEDNetwPut->Reset();
CLEDNetwGet->Reset();
CLEDProtocolStatus->Reset();
break;
}
}

View file

@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>329</height>
<width>552</width>
<height>340</height>
</rect>
</property>
<property name="windowTitle" >
@ -750,33 +750,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="cbOpenChatOnNewMessage" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lOpenChat" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Open chat on new message</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAudioCompressionType" >
<property name="title" >
@ -807,6 +780,17 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QCheckBox" name="cbOpenChatOnNewMessage" >
<property name="text" >
<string>Open chat on new message</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
@ -815,150 +799,187 @@
<property name="sizeHint" >
<size>
<width>116</width>
<height>20</height>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="lPingTime" >
<property name="text" >
<string>Ping Time:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelPingTime" >
<property name="minimumSize" >
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="text" >
<string>val</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="CMultiColorLED" native="1" name="CLEDPingTime" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
<number>2</number>
</property>
<item>
<widget class="QLabel" name="lProtocolStat" >
<property name="text" >
<string>Protocol Status:</string>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="wordWrap" >
<bool>false</bool>
<item>
<widget class="QLabel" name="lPingTime_2" >
<property name="text" >
<string>Buffer Delay</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelBufferDelay" >
<property name="minimumSize" >
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>val</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>+</string>
</property>
</widget>
</item>
<item>
<widget class="CMultiColorLED" native="1" name="CLEDProtocolStatus" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="minimumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
</widget>
<item>
<widget class="QLabel" name="lPingTime" >
<property name="text" >
<string>Ping Time</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelPingTime" >
<property name="minimumSize" >
<size>
<width>40</width>
<height>0</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>val</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="TextLabelStdDevTimerLabel" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>StdDev:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
<string>=</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="TextLabelStdDevTimer" >
<property name="text" >
<string>val</string>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
<item>
<widget class="QLabel" name="lPingTime_3" >
<property name="text" >
<string>Overall Delay</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="TextLabelOverallDelay" >
<property name="minimumSize" >
<size>
<width>45</width>
<height>0</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="frameShape" >
<enum>QFrame::Panel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
<property name="text" >
<string>val</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="CMultiColorLED" native="1" name="CLEDOverallDelay" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>13</width>
<height>13</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>