some more fixes

This commit is contained in:
Volker Fischer 2011-05-28 12:17:01 +00:00
parent 7af781447d
commit 0f46659fcb
7 changed files with 1045 additions and 998 deletions

View file

@ -188,10 +188,7 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
// this would give us problems with different threads (e.g. the // this would give us problems with different threads (e.g. the
// timer thread) and the protocol mechanism (problem with // timer thread) and the protocol mechanism (problem with
// qRegisterMetaType(), etc.) // qRegisterMetaType(), etc.)
emit ServerAutoSockBufSizeChange ( iNewNumFrames );
// TODO create new message, this one only works for client...
//emit ReqJittBufSize();
} }
return false; // -> no error return false; // -> no error
@ -295,16 +292,24 @@ void CChannel::OnSendProtMessage ( CVector<uint8_t> vecMessage )
void CChannel::OnJittBufSizeChange ( int iNewJitBufSize ) void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
{ {
// first check for special case: auto setting // for server apply setting, for client emit message
if ( iNewJitBufSize == AUTO_NET_BUF_SIZE_FOR_PROTOCOL ) if ( bIsServer )
{ {
SetDoAutoSockBufSize ( true ); // first check for special case: auto setting
if ( iNewJitBufSize == AUTO_NET_BUF_SIZE_FOR_PROTOCOL )
{
SetDoAutoSockBufSize ( true );
}
else
{
// manual setting is received, turn OFF auto setting and apply new value
SetDoAutoSockBufSize ( false );
SetSockBufNumFrames ( iNewJitBufSize, true );
}
} }
else else
{ {
// manual setting is received, turn OFF auto setting and apply new value emit JittBufSizeChanged ( iNewJitBufSize );
SetDoAutoSockBufSize ( false );
SetSockBufNumFrames ( iNewJitBufSize, true );
} }
} }

View file

@ -183,6 +183,8 @@ signals:
void MessReadyForSending ( CVector<uint8_t> vecMessage ); void MessReadyForSending ( CVector<uint8_t> vecMessage );
void NewConnection(); void NewConnection();
void ReqJittBufSize(); void ReqJittBufSize();
void JittBufSizeChanged ( int iNewJitBufSize );
void ServerAutoSockBufSizeChange ( int iNNumFra );
void ReqConnClientsList(); void ReqConnClientsList();
void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo ); void ConClientListMesReceived ( CVector<CChannelShortInfo> vecChanInfo );
void NameHasChanged(); void NameHasChanged();

View file

@ -91,6 +91,9 @@ CClient::CClient ( const quint16 iPortNumber ) :
QObject::connect ( &Channel, SIGNAL ( ReqJittBufSize() ), QObject::connect ( &Channel, SIGNAL ( ReqJittBufSize() ),
this, SLOT ( OnReqJittBufSize() ) ); this, SLOT ( OnReqJittBufSize() ) );
QObject::connect ( &Channel, SIGNAL ( JittBufSizeChanged ( int ) ),
this, SLOT ( OnJittBufSizeChanged ( int ) ) );
QObject::connect ( &Channel, SIGNAL ( ReqChanName() ), QObject::connect ( &Channel, SIGNAL ( ReqChanName() ),
this, SLOT ( OnReqChanName() ) ); this, SLOT ( OnReqChanName() ) );
@ -154,6 +157,19 @@ void CClient::OnDetectedCLMessage ( CVector<uint8_t> vecbyData,
Channel.GetAddress() ); Channel.GetAddress() );
} }
void CClient::OnJittBufSizeChanged ( int iNewJitBufSize )
{
// we received a jitter buffer size changed message from the server,
// only apply this value if auto jitter buffer size is disabled
if ( !GetDoAutoSockBufSize() )
{
// Note: Do not use the "SetServerSockBufNumFrames" function for setting
// the new server jitter buffer size since then a message would be sent
// to the server which is incorrect.
iServerSockBufNumFrames = iNewJitBufSize;
}
}
void CClient::OnNewConnection() void CClient::OnNewConnection()
{ {
// a new connection was successfully initiated, send name and request // a new connection was successfully initiated, send name and request
@ -229,15 +245,11 @@ int CClient::EvaluatePingMessage ( const int iMs )
void CClient::SetDoAutoSockBufSize ( const bool bValue ) void CClient::SetDoAutoSockBufSize ( const bool bValue )
{ {
// only act on new parameter if it is different from the current one // first, set new value in the channel object
if ( Channel.GetDoAutoSockBufSize() != bValue ) Channel.SetDoAutoSockBufSize ( bValue );
{
// first, set new value in the channel object
Channel.SetDoAutoSockBufSize ( bValue );
// inform the server about the change // inform the server about the change
CreateServerJitterBufferMessage(); CreateServerJitterBufferMessage();
}
} }
bool CClient::SetServerAddr ( QString strNAddr ) bool CClient::SetServerAddr ( QString strNAddr )

View file

@ -328,6 +328,7 @@ public slots:
void OnSendProtMessage ( CVector<uint8_t> vecMessage ); void OnSendProtMessage ( CVector<uint8_t> vecMessage );
void OnDetectedCLMessage ( CVector<uint8_t> vecbyData, int iNumBytes ); void OnDetectedCLMessage ( CVector<uint8_t> vecbyData, int iNumBytes );
void OnReqJittBufSize() { CreateServerJitterBufferMessage(); } void OnReqJittBufSize() { CreateServerJitterBufferMessage(); }
void OnJittBufSizeChanged ( int iNewJitBufSize );
void OnReqChanName() { Channel.SetRemoteName ( strName ); } void OnReqChanName() { Channel.SetRemoteName ( strName ); }
void OnNewConnection(); void OnNewConnection();
void OnCLPingReceived ( CHostAddress InetAddr, void OnCLPingReceived ( CHostAddress InetAddr,

View file

@ -116,7 +116,7 @@ LED bar: lbr
// minimum/maximum network buffer size (which can be chosen by slider) // minimum/maximum network buffer size (which can be chosen by slider)
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks #define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks
#define MAX_NET_BUF_SIZE_NUM_BL 20 // number of blocks #define MAX_NET_BUF_SIZE_NUM_BL 20 // number of blocks
#define AUTO_NET_BUF_SIZE_FOR_PROTOCOL -1 // auto set parameter (only used for protocol) #define AUTO_NET_BUF_SIZE_FOR_PROTOCOL ( MAX_NET_BUF_SIZE_NUM_BL + 1 ) // auto set parameter (only used for protocol)
// default network buffer size // default network buffer size
#define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks #define DEF_NET_BUF_SIZE_NUM_BL 10 // number of blocks

View file

@ -398,6 +398,20 @@ CServer::CServer ( const int iNewNumChan,
QObject::connect ( &vecChannels[9], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh9 ( QString ) ) ); QObject::connect ( &vecChannels[9], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh9 ( QString ) ) );
QObject::connect ( &vecChannels[10], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh10 ( QString ) ) ); QObject::connect ( &vecChannels[10], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh10 ( QString ) ) );
QObject::connect ( &vecChannels[11], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh11 ( QString ) ) ); QObject::connect ( &vecChannels[11], SIGNAL ( ChatTextReceived ( QString ) ), this, SLOT ( OnChatTextReceivedCh11 ( QString ) ) );
// auto socket buffer size change
QObject::connect ( &vecChannels[0], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh0 ( int ) ) );
QObject::connect ( &vecChannels[1], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh1 ( int ) ) );
QObject::connect ( &vecChannels[2], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh2 ( int ) ) );
QObject::connect ( &vecChannels[3], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh3 ( int ) ) );
QObject::connect ( &vecChannels[4], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh4 ( int ) ) );
QObject::connect ( &vecChannels[5], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh5 ( int ) ) );
QObject::connect ( &vecChannels[6], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh6 ( int ) ) );
QObject::connect ( &vecChannels[7], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh7 ( int ) ) );
QObject::connect ( &vecChannels[8], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh8 ( int ) ) );
QObject::connect ( &vecChannels[9], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh9 ( int ) ) );
QObject::connect ( &vecChannels[10], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh10 ( int ) ) );
QObject::connect ( &vecChannels[11], SIGNAL ( ServerAutoSockBufSizeChange ( int ) ), this, SLOT ( OnServerAutoSockBufSizeChangeCh11 ( int ) ) );
} }
void CServer::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage ) void CServer::OnSendProtMessage ( int iChID, CVector<uint8_t> vecMessage )

View file

@ -369,6 +369,19 @@ public slots:
void OnChatTextReceivedCh9 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 9, strChatText ); } void OnChatTextReceivedCh9 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 9, strChatText ); }
void OnChatTextReceivedCh10 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 10, strChatText ); } void OnChatTextReceivedCh10 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 10, strChatText ); }
void OnChatTextReceivedCh11 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 11, strChatText ); } void OnChatTextReceivedCh11 ( QString strChatText ) { CreateAndSendChatTextForAllConChannels ( 11, strChatText ); }
void OnServerAutoSockBufSizeChangeCh0 ( int iNNumFra ) { vecChannels[0].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh1 ( int iNNumFra ) { vecChannels[1].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh2 ( int iNNumFra ) { vecChannels[2].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh3 ( int iNNumFra ) { vecChannels[3].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh4 ( int iNNumFra ) { vecChannels[4].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh5 ( int iNNumFra ) { vecChannels[5].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh6 ( int iNNumFra ) { vecChannels[6].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh7 ( int iNNumFra ) { vecChannels[7].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh8 ( int iNNumFra ) { vecChannels[8].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh9 ( int iNNumFra ) { vecChannels[9].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh10 ( int iNNumFra ) { vecChannels[10].CreateJitBufMes ( iNNumFra ); }
void OnServerAutoSockBufSizeChangeCh11 ( int iNNumFra ) { vecChannels[11].CreateJitBufMes ( iNNumFra ); }
}; };
#endif /* !defined ( SERVER_HOIHGE7LOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( SERVER_HOIHGE7LOKIH83JH8_3_43445KJIUHF1912__INCLUDED_ ) */