From 3e71e83110f76b9b8935859735224174cc821d77 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 30 Oct 2006 21:14:44 +0000 Subject: [PATCH] bug fix in sound interface, prepared for new protocol message for connected client information --- linux/sound.h | 2 +- src/channel.cpp | 2 +- src/channel.h | 22 ++++++++++++++-------- src/protocol.cpp | 15 ++++++++++++++- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/linux/sound.h b/linux/sound.h index b290dc08..98512009 100755 --- a/linux/sound.h +++ b/linux/sound.h @@ -50,7 +50,7 @@ public: iCurPeriodSizeOut(NUM_PERIOD_BLOCKS_OUT), bChangParamIn(true), bChangParamOut(true) #endif - {snd_pcm_status_alloca(&status);} + {} virtual ~CSound() {Close();} /* Not implemented yet, always return one device and default string */ diff --git a/src/channel.cpp b/src/channel.cpp index c9da8333..552b9506 100755 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -226,7 +226,7 @@ void CChannelSet::GetConCliParam ( CVector& vecHostAddresses, /******************************************************************************\ * CChannel * \******************************************************************************/ -CChannel::CChannel() +CChannel::CChannel() : sName ( "" ) { // query all possible network in buffer sizes for determining if an // audio packet was received diff --git a/src/channel.h b/src/channel.h index bc426c18..a31c3f00 100755 --- a/src/channel.h +++ b/src/channel.h @@ -79,6 +79,9 @@ public: void SetAddress ( const CHostAddress NAddr ) { InetAddr = NAddr; } bool GetAddress ( CHostAddress& RetAddr ); CHostAddress GetAddress () { return InetAddr; } + + void SetName ( const std::string sNNa ) { sName = sNNa; } + std::string GetName() { return sName; } void SetSockBufSize ( const int iNumBlocks ); int GetSockBufSize() { return iCurSockBufSize; } @@ -110,32 +113,35 @@ public: protected: void SetNetwInBlSiFact ( const int iNewBlockSizeFactor ); - /* audio compression */ + // audio compression CAudioCompression AudioCompressionIn; int iAudComprSizeIn; CAudioCompression AudioCompressionOut; int iAudComprSizeOut; - /* resampling */ + // resampling CResample ResampleObj; double dSamRateOffset; CVector vecdResInData; CVector vecdResOutData; - /* connection parameters */ - CHostAddress InetAddr; + // connection parameters + CHostAddress InetAddr; + + // channel name + std::string sName; - /* network jitter-buffer */ + // network jitter-buffer CNetBuf SockBuf; int iCurSockBufSize; - /* network output conversion buffer */ + // network output conversion buffer CConvBuf ConvBuf; // network protocol CProtocol Protocol; - /* time stamp index counter */ + // time stamp index counter Q_UINT8 byTimeStampIdxCnt; int iTimeStampActCnt; @@ -147,7 +153,7 @@ protected: int iCurNetwInBlSiFact; int iCurNetwOutBlSiFact; - QMutex Mutex; + QMutex Mutex; public slots: void OnSendProtMessage ( CVector vecMessage ); diff --git a/src/protocol.cpp b/src/protocol.cpp index 0b1070f0..e343bce8 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -57,8 +57,13 @@ MESSAGES | 2 bytes factor | +----------------+ +- IP number and name of connected clients PROTMESSID_CONN_CLIENTS_LIST + for each connected client append following data: + +--------------------+------------------+----------------------+ + | 4 bytes IP address | 2 bytes number n | n bytes UTF-8 string | + +--------------------+------------------+----------------------+ * ****************************************************************************** @@ -365,6 +370,14 @@ void CProtocol::CreateNetwBlSiFactMes ( const int iNetwBlSiFact ) CreateAndSendMessage ( PROTMESSID_NET_BLSI_FACTOR, vecData ); } +//void CProtocol::CreateConClientListMes ( const ) +//{ +// TODO +//PROTMESSID_CONN_CLIENTS_LIST + + +//} + /******************************************************************************\ * Message generation (parsing) * @@ -403,7 +416,7 @@ bool CProtocol::ParseMessageFrame ( const CVector& vecIn, iLenBy = static_cast ( GetValFromStream ( vecIn, iCurPos, 2 ) ); // make sure the length is correct - if ( iLenBy != iVecInLenByte - MESS_LEN_WITHOUT_DATA_BYTE ) + if ( iLenBy != iVecInLenByte - MESS_LEN_WITHOUT_DATA_BYTE ) { return false; // return error code }