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 ); GroupBoxNetwBuf->setWhatsThis ( strNetwBlockSize );
// init timing jitter text label // init timing jitter text label
TextLabelStdDevTimer->setText ( "" ); //TextLabelStdDevTimer->setText ( "" );
// ping time controls // init delay information controls
CLEDPingTime->SetUpdateTime ( 2 * PING_UPDATE_TIME ); CLEDOverallDelay->SetUpdateTime ( 2 * PING_UPDATE_TIME );
CLEDPingTime->Reset(); CLEDOverallDelay->Reset();
TextLabelPingTime->setText ( "" ); TextLabelPingTime->setText ( "" );
TextLabelBufferDelay->setText ( "" );
TextLabelOverallDelay->setText ( "" );
// init slider controls --- // init slider controls ---
// sound buffer in // sound buffer in
@ -291,23 +293,50 @@ void CClientSettingsDlg::OnTimerPing()
void CClientSettingsDlg::OnPingTimeResult ( int iPingTime ) 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 else
{ {
if ( iPingTime < 50 ) if ( iOverallDelay <= 60 )
{ {
CLEDPingTime->SetLight ( MUL_COL_LED_YELLOW ); CLEDOverallDelay->SetLight ( MUL_COL_LED_YELLOW );
} }
else else
{ {
CLEDPingTime->SetLight ( MUL_COL_LED_RED ); CLEDOverallDelay->SetLight ( MUL_COL_LED_RED );
} }
} }
TextLabelPingTime->setText ( QString().setNum ( iPingTime ) + " ms" );
} }
void CClientSettingsDlg::UpdateDisplay() void CClientSettingsDlg::UpdateDisplay()
@ -315,14 +344,16 @@ void CClientSettingsDlg::UpdateDisplay()
if ( pClient->IsRunning() ) if ( pClient->IsRunning() )
{ {
// response time // response time
TextLabelStdDevTimer->setText ( QString(). //TextLabelStdDevTimer->setText ( QString().
setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" ); // setNum ( pClient->GetTimingStdDev(), 'f', 2 ) + " ms" );
} }
else else
{ {
// clear text labels with client parameters // clear text labels with client parameters
TextLabelStdDevTimer->setText ( "" ); //TextLabelStdDevTimer->setText ( "" );
TextLabelPingTime->setText ( "" ); TextLabelPingTime->setText ( "" );
TextLabelBufferDelay->setText ( "" );
TextLabelOverallDelay->setText ( "" );
} }
} }
@ -346,15 +377,11 @@ void CClientSettingsDlg::SetStatus ( const int iMessType, const int iStatus )
CLEDNetwGet->SetLight ( iStatus ); CLEDNetwGet->SetLight ( iStatus );
break; break;
case MS_PROTOCOL:
CLEDProtocolStatus->SetLight ( iStatus );
case MS_RESET_ALL: case MS_RESET_ALL:
CLEDSoundIn->Reset(); CLEDSoundIn->Reset();
CLEDSoundOut->Reset(); CLEDSoundOut->Reset();
CLEDNetwPut->Reset(); CLEDNetwPut->Reset();
CLEDNetwGet->Reset(); CLEDNetwGet->Reset();
CLEDProtocolStatus->Reset();
break; break;
} }
} }

View file

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>506</width> <width>552</width>
<height>329</height> <height>340</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -750,33 +750,6 @@
</item> </item>
</layout> </layout>
</item> </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> <item>
<widget class="QGroupBox" name="groupBoxAudioCompressionType" > <widget class="QGroupBox" name="groupBoxAudioCompressionType" >
<property name="title" > <property name="title" >
@ -807,6 +780,17 @@
</layout> </layout>
</widget> </widget>
</item> </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> <item>
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
@ -815,150 +799,187 @@
<property name="sizeHint" > <property name="sizeHint" >
<size> <size>
<width>116</width> <width>116</width>
<height>20</height> <height>16</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </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> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout" >
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>2</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> </property>
<item> <item>
<widget class="QLabel" name="lProtocolStat" > <layout class="QVBoxLayout" >
<property name="text" > <property name="spacing" >
<string>Protocol Status:</string> <number>0</number>
</property> </property>
<property name="wordWrap" > <item>
<bool>false</bool> <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> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="CMultiColorLED" native="1" name="CLEDProtocolStatus" > <layout class="QVBoxLayout" >
<property name="sizePolicy" > <property name="spacing" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" > <number>0</number>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="minimumSize" > <item>
<size> <widget class="QLabel" name="lPingTime" >
<width>13</width> <property name="text" >
<height>13</height> <string>Ping Time</string>
</size> </property>
</property> <property name="alignment" >
<property name="maximumSize" > <set>Qt::AlignCenter</set>
<size> </property>
<width>13</width> <property name="wordWrap" >
<height>13</height> <bool>true</bool>
</size> </property>
</property> </widget>
</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> </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> <item>
<widget class="QLabel" name="TextLabelStdDevTimerLabel" > <widget class="QLabel" name="label_2" >
<property name="text" > <property name="text" >
<string>StdDev:</string> <string>=</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="TextLabelStdDevTimer" > <layout class="QVBoxLayout" >
<property name="text" > <property name="spacing" >
<string>val</string> <number>0</number>
</property> </property>
<property name="wordWrap" > <item>
<bool>false</bool> <widget class="QLabel" name="lPingTime_3" >
</property> <property name="text" >
</widget> <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> </item>
</layout> </layout>
</item> </item>