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

View file

@ -172,10 +172,12 @@ void CClient::OnNewConnection()
void CClient::CreateServerJitterBufferMessage()
{
// in case auto jitter buffer size is enabled, we have to transmit a
// special value
// per definition in the client: if auto jitter buffer is enabled, both,
// the client and server shall use an auto jitter buffer
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 );
}
else
@ -225,6 +227,19 @@ int CClient::EvaluatePingMessage ( const int 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 )
{
CHostAddress HostAddress;

View file

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