removed sample rate offset estimation for now

This commit is contained in:
Volker Fischer 2006-02-26 13:27:19 +00:00
parent c19794c7ce
commit 2d3c5d54ca
10 changed files with 14 additions and 134 deletions

View file

@ -157,14 +157,12 @@ void CChannelSet::GetBlockAllConC ( CVector<int>& vecChanID,
} }
void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses, void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<double>& vecdSamOffs,
CVector<int>& veciJitBufSize ) CVector<int>& veciJitBufSize )
{ {
CHostAddress InetAddr; CHostAddress InetAddr;
/* init return values */ /* init return values */
vecHostAddresses.Init ( MAX_NUM_CHANNELS ); vecHostAddresses.Init ( MAX_NUM_CHANNELS );
vecdSamOffs.Init ( MAX_NUM_CHANNELS );
veciJitBufSize.Init ( MAX_NUM_CHANNELS ); veciJitBufSize.Init ( MAX_NUM_CHANNELS );
/* Check all possible channels */ /* Check all possible channels */
@ -174,7 +172,6 @@ void CChannelSet::GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
{ {
/* add new address and sample rate offset to vectors */ /* add new address and sample rate offset to vectors */
vecHostAddresses[i] = InetAddr; vecHostAddresses[i] = InetAddr;
vecdSamOffs[i] = vecChannels[i].GetResampleOffset ();
veciJitBufSize[i] = vecChannels[i].GetSockBufSize (); veciJitBufSize[i] = vecChannels[i].GetSockBufSize ();
} }
} }
@ -200,9 +197,6 @@ for ( int i = 0; i < MAX_NUM_CHANNELS; i++ )
\******************************************************************************/ \******************************************************************************/
CChannel::CChannel () CChannel::CChannel ()
{ {
/* init time stamp activation counter */
iTimeStampActCnt = NUM_BL_TIME_STAMPS;
/* init time stamp index counter */ /* init time stamp index counter */
byTimeStampIdxCnt = 0; byTimeStampIdxCnt = 0;
@ -219,9 +213,6 @@ CChannel::CChannel ()
/* init time-out for the buffer with zero -> no connection */ /* init time-out for the buffer with zero -> no connection */
iConTimeOut = 0; iConTimeOut = 0;
/* init sample rate offset estimation object */
SampleOffsetEst.Init();
/* connections ---------------------------------------------------------- */ /* connections ---------------------------------------------------------- */
// just route message through this class // just route message through this class
@ -287,11 +278,6 @@ for (int i = 0; i < BLOCK_SIZE_SAMPLES; i++)
/* reset time-out counter */ /* reset time-out counter */
iConTimeOut = CON_TIME_OUT_CNT_MAX; iConTimeOut = CON_TIME_OUT_CNT_MAX;
} }
else if ( iNumBytes == 1 )
{
/* time stamp packet */
SampleOffsetEst.AddTimeStampIdx ( vecbyData[0] );
}
else else
{ {
@ -322,13 +308,6 @@ bool CChannel::GetData ( CVector<double>& vecdData )
if ( iConTimeOut > 0 ) if ( iConTimeOut > 0 )
{ {
iConTimeOut--; iConTimeOut--;
/* if time out is reached, re-init resample offset estimation
module */
if ( iConTimeOut == 0 )
{
SampleOffsetEst.Init ();
}
} }
} }
@ -355,25 +334,6 @@ CVector<unsigned char> CChannel::PrepSendPacket(const CVector<short>& vecsNPacke
return vecbySendBuf; return vecbySendBuf;
} }
int CChannel::GetTimeStampIdx ()
{
/* only send time stamp index after a pre-defined number of packets */
if ( iTimeStampActCnt > 0 )
{
iTimeStampActCnt--;
return INVALID_TIME_STAMP_IDX;
}
else
{
/* reset time stamp activation counter */
iTimeStampActCnt = NUM_BL_TIME_STAMPS - 1;
/* wraps around automatically */
byTimeStampIdxCnt++;
return byTimeStampIdxCnt;
}
}
/******************************************************************************\ /******************************************************************************\
* CSampleOffsetEst * * CSampleOffsetEst *

View file

@ -48,9 +48,6 @@
/* no valid channel number */ /* no valid channel number */
#define INVALID_CHANNEL_ID (MAX_NUM_CHANNELS + 1) #define INVALID_CHANNEL_ID (MAX_NUM_CHANNELS + 1)
/* no valid time stamp index */
#define INVALID_TIME_STAMP_IDX -1
/* Classes ********************************************************************/ /* Classes ********************************************************************/
class CSampleOffsetEst class CSampleOffsetEst
@ -91,9 +88,7 @@ public:
bool IsConnected () const { return iConTimeOut > 0; } bool IsConnected () const { return iConTimeOut > 0; }
int GetTimeStampIdx ();
int GetComprAudSize () { return iAudComprSize; } int GetComprAudSize () { return iAudComprSize; }
double GetResampleOffset () { return SampleOffsetEst.GetSamRate (); }
void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; }
bool GetAddress ( CHostAddress& RetAddr ); bool GetAddress ( CHostAddress& RetAddr );
@ -119,8 +114,6 @@ protected:
CVector<double> vecdResInData; CVector<double> vecdResInData;
CVector<double> vecdResOutData; CVector<double> vecdResOutData;
CSampleOffsetEst SampleOffsetEst;
/* connection parameters */ /* connection parameters */
CHostAddress InetAddr; CHostAddress InetAddr;
@ -162,7 +155,6 @@ public:
void GetBlockAllConC(CVector<int>& vecChanID, void GetBlockAllConC(CVector<int>& vecChanID,
CVector<CVector<double> >& vecvecdData); CVector<CVector<double> >& vecvecdData);
void GetConCliParam(CVector<CHostAddress>& vecHostAddresses, void GetConCliParam(CVector<CHostAddress>& vecHostAddresses,
CVector<double>& vecdSamOffs,
CVector<int>& veciJitBufSize); CVector<int>& veciJitBufSize);
/* access functions for actual channels */ /* access functions for actual channels */
@ -173,8 +165,6 @@ public:
{return vecChannels[iChanNum].PrepSendPacket(vecsNPacket);} {return vecChannels[iChanNum].PrepSendPacket(vecsNPacket);}
CHostAddress GetAddress(const int iChanNum) CHostAddress GetAddress(const int iChanNum)
{return vecChannels[iChanNum].GetAddress();} {return vecChannels[iChanNum].GetAddress();}
int GetTimeStampIdx(const int iChanNum)
{return vecChannels[iChanNum].GetTimeStampIdx();}
void SetSockBufSize ( const int iNewBlockSize, const int iNumBlocks); void SetSockBufSize ( const int iNewBlockSize, const int iNumBlocks);
int GetSockBufSize() {return vecChannels[0].GetSockBufSize();} int GetSockBufSize() {return vecChannels[0].GetSockBufSize();}

View file

@ -31,24 +31,19 @@ CClient::CClient () : bRun ( false ), Socket ( &Channel ),
iReverbLevel ( AUD_REVERB_MAX / 6 ), iReverbLevel ( AUD_REVERB_MAX / 6 ),
bReverbOnLeftChan ( false ) bReverbOnLeftChan ( false )
{ {
// connection for protocol
QObject::connect ( &Channel, SIGNAL ( MessReadyForSending () ), QObject::connect ( &Channel, SIGNAL ( MessReadyForSending () ),
this, SLOT ( OnSendProtMessage () ) ); this, SLOT ( OnSendProtMessage () ) );
} }
void CClient::OnSendProtMessage () void CClient::OnSendProtMessage ()
{ {
// the protocol queries me to call the function to send the message // the protocol queries me to call the function to send the message
// send it through the network // send it through the network
Socket.SendPacket ( Channel.GetSendMessage (), Socket.SendPacket ( Channel.GetSendMessage (),
Channel.GetAddress(), Channel.GetTimeStampIdx() ); Channel.GetAddress () );
} }
bool CClient::SetServerAddr(QString strNAddr) bool CClient::SetServerAddr(QString strNAddr)
{ {
QHostAddress InetAddr; QHostAddress InetAddr;
@ -205,7 +200,7 @@ void CClient::run()
/* send it through the network */ /* send it through the network */
Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ), Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ),
Channel.GetAddress(), Channel.GetTimeStampIdx()); Channel.GetAddress () );
/* receive a new block */ /* receive a new block */
if (Channel.GetData(vecdNetwData)) if (Channel.GetData(vecdNetwData))

View file

@ -67,9 +67,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent,
/* init status label */ /* init status label */
OnTimerStatus (); OnTimerStatus ();
/* init sample rate offset label */
TextSamRateOffsValue->setText ( "0 Hz" );
/* init connection button text */ /* init connection button text */
PushButtonConnect->setText ( CON_BUT_CONNECTTEXT ); PushButtonConnect->setText ( CON_BUT_CONNECTTEXT );
@ -289,11 +286,6 @@ void CLlconClientDlg::OnTimerStatus ()
TextLabelStatus->setText ( tr ( "disconnected" ) ); TextLabelStatus->setText ( tr ( "disconnected" ) );
} }
/* update sample rate offset label */
QString strSamRaOffs;
strSamRaOffs.setNum(pClient->GetChannel()->GetResampleOffset(), 'f', 2);
TextSamRateOffsValue->setText(strSamRaOffs + " Hz");
/* response time */ /* response time */
TextLabelStdDevTimer->setText(QString(). TextLabelStdDevTimer->setText(QString().
setNum(pClient->GetTimingStdDev(), 'f', 2) + " ms"); setNum(pClient->GetTimingStdDev(), 'f', 2) + " ms");

View file

@ -1049,45 +1049,6 @@
</widget> </widget>
</hbox> </hbox>
</widget> </widget>
<widget>
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout18</cstring>
</property>
<hbox>
<property stdset="1">
<name>margin</name>
<number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextLabelSamOffset</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>Fs Offs:</string>
</property>
</widget>
<widget>
<class>QLabel</class>
<property stdset="1">
<name>name</name>
<cstring>TextSamRateOffsValue</cstring>
</property>
<property stdset="1">
<name>text</name>
<string>24000.00 Hz</string>
</property>
</widget>
</hbox>
</widget>
</vbox> </vbox>
</widget> </widget>
</hbox> </hbox>

View file

@ -56,8 +56,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent,
ListViewClients->setColumnAlignment(2, Qt::AlignCenter); ListViewClients->setColumnAlignment(2, Qt::AlignCenter);
ListViewClients->addColumn(tr("Jitter buffer size")); ListViewClients->addColumn(tr("Jitter buffer size"));
ListViewClients->setColumnAlignment(3, Qt::AlignRight); ListViewClients->setColumnAlignment(3, Qt::AlignRight);
ListViewClients->addColumn(tr("Sample-rate offset [Hz]"));
ListViewClients->setColumnAlignment(4, Qt::AlignRight);
ListViewClients->clear(); ListViewClients->clear();
/* insert items in reverse order because in Windows all of them are /* insert items in reverse order because in Windows all of them are
@ -108,13 +106,12 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent,
void CLlconServerDlg::OnTimer() void CLlconServerDlg::OnTimer()
{ {
CVector<CHostAddress> vecHostAddresses; CVector<CHostAddress> vecHostAddresses;
CVector<double> vecdSamOffs;
CVector<int> veciJitBufSize; CVector<int> veciJitBufSize;
double dCurTiStdDev; double dCurTiStdDev;
ListViewMutex.lock(); ListViewMutex.lock();
pServer->GetConCliParam(vecHostAddresses, vecdSamOffs, veciJitBufSize); pServer->GetConCliParam(vecHostAddresses, veciJitBufSize);
/* fill list with connected clients */ /* fill list with connected clients */
for (int i = 0; i < MAX_NUM_CHANNELS; i++) for (int i = 0; i < MAX_NUM_CHANNELS; i++)
@ -130,11 +127,6 @@ void CLlconServerDlg::OnTimer()
vecpListViewItems[i]->setText(3, vecpListViewItems[i]->setText(3,
QString().setNum(veciJitBufSize[i])); QString().setNum(veciJitBufSize[i]));
/* sample rate offset */
// FIXME disable sample rate estimation result label since estimation does not work
// vecpListViewItems[i]->setText(4,
// QString().sprintf("%5.2f", vecdSamOffs[i]));
#ifndef _WIN32 #ifndef _WIN32
vecpListViewItems[i]->setVisible ( true ); vecpListViewItems[i]->setVisible ( true );
#endif #endif

View file

@ -87,8 +87,7 @@ void CServer::OnTimer ()
{ {
Socket.SendPacket ( Socket.SendPacket (
ChannelSet.PrepSendPacket ( vecChanID[i], vecsSendData ), ChannelSet.PrepSendPacket ( vecChanID[i], vecsSendData ),
ChannelSet.GetAddress ( vecChanID[i] ), ChannelSet.GetAddress ( vecChanID[i] ) );
ChannelSet.GetTimeStampIdx ( vecChanID[i] ) );
} }

View file

@ -49,9 +49,9 @@ public:
void Stop (); void Stop ();
bool IsRunning() { return Timer.isActive (); } bool IsRunning() { return Timer.isActive (); }
void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses, void GetConCliParam ( CVector<CHostAddress>& vecHostAddresses,
CVector<double>& vecdSamOffs, CVector<int>& veciJitBufSize ) CVector<int>& veciJitBufSize )
{ {
ChannelSet.GetConCliParam ( vecHostAddresses, vecdSamOffs, ChannelSet.GetConCliParam ( vecHostAddresses,
veciJitBufSize ); veciJitBufSize );
} }

View file

@ -67,8 +67,7 @@ void CSocket::Init ()
} }
void CSocket::SendPacket ( const CVector<unsigned char>& vecbySendBuf, void CSocket::SendPacket ( const CVector<unsigned char>& vecbySendBuf,
const CHostAddress& HostAddr, const CHostAddress& HostAddr )
const int iTimeStampIdx )
{ {
const int iVecSizeOut = vecbySendBuf.Size (); const int iVecSizeOut = vecbySendBuf.Size ();
@ -79,14 +78,6 @@ void CSocket::SendPacket( const CVector<unsigned char>& vecbySendBuf,
(const char*) &( (CVector<unsigned char>) vecbySendBuf )[0], (const char*) &( (CVector<unsigned char>) vecbySendBuf )[0],
iVecSizeOut, HostAddr.InetAddr, HostAddr.iPort ); iVecSizeOut, HostAddr.InetAddr, HostAddr.iPort );
} }
/* sent time stamp if required */
if ( iTimeStampIdx != INVALID_TIME_STAMP_IDX )
{
/* Always one byte long */
SocketDevice.writeBlock ( (const char*) &iTimeStampIdx, 1,
HostAddr.InetAddr, HostAddr.iPort );
}
} }
void CSocket::OnDataReceived () void CSocket::OnDataReceived ()

View file

@ -57,7 +57,7 @@ public:
virtual ~CSocket() {} virtual ~CSocket() {}
void SendPacket ( const CVector<unsigned char>& vecbySendBuf, void SendPacket ( const CVector<unsigned char>& vecbySendBuf,
const CHostAddress& HostAddr, const int iTimeStampIdx); const CHostAddress& HostAddr );
protected: protected:
void Init(); void Init();