some fixes for server jitter buffer setting but still not working correctly

This commit is contained in:
Volker Fischer 2011-05-28 06:01:26 +00:00
parent 439dd65b46
commit 7af781447d
3 changed files with 30 additions and 15 deletions

View file

@ -203,20 +203,20 @@ bool CChannel::SetSockBufNumFrames ( const int iNewNumFrames,
void CChannel::SetDoAutoSockBufSize ( const bool bValue ) void CChannel::SetDoAutoSockBufSize ( const bool bValue )
{ {
// in case auto socket buffer size was just enabled, reset statistic and in QMutexLocker locker ( &Mutex );
// case of the client, inform the server about the change
if ( ( bDoAutoSockBufSize != bValue ) && bValue ) // only act on new value if it is different from the current one
if ( bDoAutoSockBufSize != bValue )
{ {
CycleTimeVariance.Reset(); if ( bValue )
if ( !bIsServer )
{ {
CreateJitBufMes ( AUTO_NET_BUF_SIZE_FOR_PROTOCOL ); // in case auto socket buffer size was just enabled, reset statistic
CycleTimeVariance.Reset();
} }
}
// store new setting // store new setting
bDoAutoSockBufSize = bValue; bDoAutoSockBufSize = bValue;
}
} }
void CChannel::SetGain ( const int iChanID, void CChannel::SetGain ( const int iChanID,
@ -302,6 +302,8 @@ void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
} }
else else
{ {
// manual setting is received, turn OFF auto setting and apply new value
SetDoAutoSockBufSize ( false );
SetSockBufNumFrames ( iNewJitBufSize, true ); SetSockBufNumFrames ( iNewJitBufSize, true );
} }
} }

View file

@ -172,10 +172,12 @@ void CClient::OnNewConnection()
void CClient::CreateServerJitterBufferMessage() void CClient::CreateServerJitterBufferMessage()
{ {
// in case auto jitter buffer size is enabled, we have to transmit a // per definition in the client: if auto jitter buffer is enabled, both,
// special value // the client and server shall use an auto jitter buffer
if ( GetDoAutoSockBufSize() ) if ( GetDoAutoSockBufSize() )
{ {
// in case auto jitter buffer size is enabled, we have to transmit a
// special value
Channel.CreateJitBufMes ( AUTO_NET_BUF_SIZE_FOR_PROTOCOL ); Channel.CreateJitBufMes ( AUTO_NET_BUF_SIZE_FOR_PROTOCOL );
} }
else else
@ -225,6 +227,19 @@ int CClient::EvaluatePingMessage ( const int iMs )
return PreciseTime.elapsed() - iMs; return PreciseTime.elapsed() - iMs;
} }
void CClient::SetDoAutoSockBufSize ( const bool bValue )
{
// only act on new parameter if it is different from the current one
if ( Channel.GetDoAutoSockBufSize() != bValue )
{
// first, set new value in the channel object
Channel.SetDoAutoSockBufSize ( bValue );
// inform the server about the change
CreateServerJitterBufferMessage();
}
}
bool CClient::SetServerAddr ( QString strNAddr ) bool CClient::SetServerAddr ( QString strNAddr )
{ {
CHostAddress HostAddress; CHostAddress HostAddress;

View file

@ -132,9 +132,7 @@ public:
AudioReverbR.Clear(); AudioReverbR.Clear();
} }
void SetDoAutoSockBufSize ( const bool bValue ) void SetDoAutoSockBufSize ( const bool bValue );
{ Channel.SetDoAutoSockBufSize ( bValue ); }
bool GetDoAutoSockBufSize() const { return Channel.GetDoAutoSockBufSize(); } bool GetDoAutoSockBufSize() const { return Channel.GetDoAutoSockBufSize(); }
void SetSockBufNumFrames ( const int iNumBlocks, void SetSockBufNumFrames ( const int iNumBlocks,