From 2d3c5d54ca8d9476aa714049a04ce8cd1c87b02b Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sun, 26 Feb 2006 13:27:19 +0000 Subject: [PATCH] removed sample rate offset estimation for now --- src/channel.cpp | 40 --------------------------------------- src/channel.h | 10 ---------- src/client.cpp | 17 ++++++----------- src/llconclientdlg.cpp | 8 -------- src/llconclientdlgbase.ui | 39 -------------------------------------- src/llconserverdlg.cpp | 10 +--------- src/server.cpp | 3 +-- src/server.h | 4 ++-- src/socket.cpp | 13 ++----------- src/socket.h | 4 ++-- 10 files changed, 14 insertions(+), 134 deletions(-) diff --git a/src/channel.cpp b/src/channel.cpp index fb780709..94623d63 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -157,14 +157,12 @@ void CChannelSet::GetBlockAllConC ( CVector& vecChanID, } void CChannelSet::GetConCliParam ( CVector& vecHostAddresses, - CVector& vecdSamOffs, CVector& veciJitBufSize ) { CHostAddress InetAddr; /* init return values */ vecHostAddresses.Init ( MAX_NUM_CHANNELS ); - vecdSamOffs.Init ( MAX_NUM_CHANNELS ); veciJitBufSize.Init ( MAX_NUM_CHANNELS ); /* Check all possible channels */ @@ -174,7 +172,6 @@ void CChannelSet::GetConCliParam ( CVector& vecHostAddresses, { /* add new address and sample rate offset to vectors */ vecHostAddresses[i] = InetAddr; - vecdSamOffs[i] = vecChannels[i].GetResampleOffset (); veciJitBufSize[i] = vecChannels[i].GetSockBufSize (); } } @@ -200,9 +197,6 @@ for ( int i = 0; i < MAX_NUM_CHANNELS; i++ ) \******************************************************************************/ CChannel::CChannel () { - /* init time stamp activation counter */ - iTimeStampActCnt = NUM_BL_TIME_STAMPS; - /* init time stamp index counter */ byTimeStampIdxCnt = 0; @@ -218,9 +212,6 @@ CChannel::CChannel () /* init time-out for the buffer with zero -> no connection */ iConTimeOut = 0; - - /* init sample rate offset estimation object */ - SampleOffsetEst.Init(); /* connections ---------------------------------------------------------- */ @@ -287,11 +278,6 @@ for (int i = 0; i < BLOCK_SIZE_SAMPLES; i++) /* reset time-out counter */ iConTimeOut = CON_TIME_OUT_CNT_MAX; } - else if ( iNumBytes == 1 ) - { - /* time stamp packet */ - SampleOffsetEst.AddTimeStampIdx ( vecbyData[0] ); - } else { @@ -322,13 +308,6 @@ bool CChannel::GetData ( CVector& vecdData ) if ( iConTimeOut > 0 ) { iConTimeOut--; - - /* if time out is reached, re-init resample offset estimation - module */ - if ( iConTimeOut == 0 ) - { - SampleOffsetEst.Init (); - } } } @@ -355,25 +334,6 @@ CVector CChannel::PrepSendPacket(const CVector& vecsNPacke 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 * diff --git a/src/channel.h b/src/channel.h index 29bb390b..a1608ecf 100755 --- a/src/channel.h +++ b/src/channel.h @@ -48,9 +48,6 @@ /* no valid channel number */ #define INVALID_CHANNEL_ID (MAX_NUM_CHANNELS + 1) -/* no valid time stamp index */ -#define INVALID_TIME_STAMP_IDX -1 - /* Classes ********************************************************************/ class CSampleOffsetEst @@ -91,9 +88,7 @@ public: bool IsConnected () const { return iConTimeOut > 0; } - int GetTimeStampIdx (); int GetComprAudSize () { return iAudComprSize; } - double GetResampleOffset () { return SampleOffsetEst.GetSamRate (); } void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } bool GetAddress ( CHostAddress& RetAddr ); @@ -119,8 +114,6 @@ protected: CVector vecdResInData; CVector vecdResOutData; - CSampleOffsetEst SampleOffsetEst; - /* connection parameters */ CHostAddress InetAddr; @@ -162,7 +155,6 @@ public: void GetBlockAllConC(CVector& vecChanID, CVector >& vecvecdData); void GetConCliParam(CVector& vecHostAddresses, - CVector& vecdSamOffs, CVector& veciJitBufSize); /* access functions for actual channels */ @@ -173,8 +165,6 @@ public: {return vecChannels[iChanNum].PrepSendPacket(vecsNPacket);} CHostAddress GetAddress(const int iChanNum) {return vecChannels[iChanNum].GetAddress();} - int GetTimeStampIdx(const int iChanNum) - {return vecChannels[iChanNum].GetTimeStampIdx();} void SetSockBufSize ( const int iNewBlockSize, const int iNumBlocks); int GetSockBufSize() {return vecChannels[0].GetSockBufSize();} diff --git a/src/client.cpp b/src/client.cpp index 37ac08ff..c36a0624 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -31,23 +31,18 @@ CClient::CClient () : bRun ( false ), Socket ( &Channel ), iReverbLevel ( AUD_REVERB_MAX / 6 ), bReverbOnLeftChan ( false ) { - QObject::connect(&Channel, SIGNAL(MessReadyForSending()), - this, SLOT(OnSendProtMessage())); + // connection for protocol + QObject::connect ( &Channel, SIGNAL ( MessReadyForSending () ), + this, SLOT ( OnSendProtMessage () ) ); } void CClient::OnSendProtMessage () { - // the protocol queries me to call the function to send the message // send it through the network Socket.SendPacket ( Channel.GetSendMessage (), - Channel.GetAddress(), Channel.GetTimeStampIdx() ); - - - + Channel.GetAddress () ); } - - bool CClient::SetServerAddr(QString strNAddr) { @@ -204,8 +199,8 @@ void CClient::run() } /* send it through the network */ - Socket.SendPacket(Channel.PrepSendPacket(vecsNetwork), - Channel.GetAddress(), Channel.GetTimeStampIdx()); + Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ), + Channel.GetAddress () ); /* receive a new block */ if (Channel.GetData(vecdNetwData)) diff --git a/src/llconclientdlg.cpp b/src/llconclientdlg.cpp index 1f4f1c21..3b0619a4 100755 --- a/src/llconclientdlg.cpp +++ b/src/llconclientdlg.cpp @@ -67,9 +67,6 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP, QWidget* parent, /* init status label */ OnTimerStatus (); - /* init sample rate offset label */ - TextSamRateOffsValue->setText ( "0 Hz" ); - /* init connection button text */ PushButtonConnect->setText ( CON_BUT_CONNECTTEXT ); @@ -288,11 +285,6 @@ void CLlconClientDlg::OnTimerStatus () { TextLabelStatus->setText ( tr ( "disconnected" ) ); } - - /* update sample rate offset label */ - QString strSamRaOffs; - strSamRaOffs.setNum(pClient->GetChannel()->GetResampleOffset(), 'f', 2); - TextSamRateOffsValue->setText(strSamRaOffs + " Hz"); /* response time */ TextLabelStdDevTimer->setText(QString(). diff --git a/src/llconclientdlgbase.ui b/src/llconclientdlgbase.ui index ececc91c..509d3523 100755 --- a/src/llconclientdlgbase.ui +++ b/src/llconclientdlgbase.ui @@ -1049,45 +1049,6 @@ - - QLayoutWidget - - name - Layout18 - - - - margin - 0 - - - spacing - 6 - - - QLabel - - name - TextLabelSamOffset - - - text - Fs Offs: - - - - QLabel - - name - TextSamRateOffsValue - - - text - 24000.00 Hz - - - - diff --git a/src/llconserverdlg.cpp b/src/llconserverdlg.cpp index a9e549a7..b22f4710 100755 --- a/src/llconserverdlg.cpp +++ b/src/llconserverdlg.cpp @@ -56,8 +56,6 @@ CLlconServerDlg::CLlconServerDlg ( CServer* pNServP, QWidget* parent, ListViewClients->setColumnAlignment(2, Qt::AlignCenter); ListViewClients->addColumn(tr("Jitter buffer size")); ListViewClients->setColumnAlignment(3, Qt::AlignRight); - ListViewClients->addColumn(tr("Sample-rate offset [Hz]")); - ListViewClients->setColumnAlignment(4, Qt::AlignRight); ListViewClients->clear(); /* 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() { CVector vecHostAddresses; - CVector vecdSamOffs; CVector veciJitBufSize; double dCurTiStdDev; ListViewMutex.lock(); - pServer->GetConCliParam(vecHostAddresses, vecdSamOffs, veciJitBufSize); + pServer->GetConCliParam(vecHostAddresses, veciJitBufSize); /* fill list with connected clients */ for (int i = 0; i < MAX_NUM_CHANNELS; i++) @@ -130,11 +127,6 @@ void CLlconServerDlg::OnTimer() vecpListViewItems[i]->setText(3, 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 vecpListViewItems[i]->setVisible ( true ); #endif diff --git a/src/server.cpp b/src/server.cpp index d16af6f8..61115be3 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -87,8 +87,7 @@ void CServer::OnTimer () { Socket.SendPacket ( ChannelSet.PrepSendPacket ( vecChanID[i], vecsSendData ), - ChannelSet.GetAddress ( vecChanID[i] ), - ChannelSet.GetTimeStampIdx ( vecChanID[i] ) ); + ChannelSet.GetAddress ( vecChanID[i] ) ); } diff --git a/src/server.h b/src/server.h index c2345228..444a7328 100755 --- a/src/server.h +++ b/src/server.h @@ -49,9 +49,9 @@ public: void Stop (); bool IsRunning() { return Timer.isActive (); } void GetConCliParam ( CVector& vecHostAddresses, - CVector& vecdSamOffs, CVector& veciJitBufSize ) + CVector& veciJitBufSize ) { - ChannelSet.GetConCliParam ( vecHostAddresses, vecdSamOffs, + ChannelSet.GetConCliParam ( vecHostAddresses, veciJitBufSize ); } diff --git a/src/socket.cpp b/src/socket.cpp index bb7db020..f48c78c9 100755 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -66,9 +66,8 @@ void CSocket::Init () this, SLOT ( OnDataReceived () ) ); } -void CSocket::SendPacket( const CVector& vecbySendBuf, - const CHostAddress& HostAddr, - const int iTimeStampIdx ) +void CSocket::SendPacket ( const CVector& vecbySendBuf, + const CHostAddress& HostAddr ) { const int iVecSizeOut = vecbySendBuf.Size (); @@ -79,14 +78,6 @@ void CSocket::SendPacket( const CVector& vecbySendBuf, (const char*) &( (CVector) vecbySendBuf )[0], 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 () diff --git a/src/socket.h b/src/socket.h index 71e712fc..fc099808 100755 --- a/src/socket.h +++ b/src/socket.h @@ -56,8 +56,8 @@ public: {Init();} virtual ~CSocket() {} - void SendPacket(const CVector& vecbySendBuf, - const CHostAddress& HostAddr, const int iTimeStampIdx); + void SendPacket ( const CVector& vecbySendBuf, + const CHostAddress& HostAddr ); protected: void Init();