This commit is contained in:
Volker Fischer 2009-05-13 07:14:08 +00:00
parent f005ddcd05
commit 9111f327a5
4 changed files with 28 additions and 15 deletions

View file

@ -691,9 +691,14 @@ CChannel::CChannel ( const bool bNIsServer ) :
// network block size factor must start from 1 -> i + 1
const int iCurNetBlockSizeFact = i + 1;
vecNetwBufferInProps[iNoneIdx].iAudioBlockSize = iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
vecNetwBufferInProps[iIMAIdx].iAudioBlockSize = iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
vecNetwBufferInProps[iMSIdx].iAudioBlockSize = iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
vecNetwBufferInProps[iNoneIdx].iAudioBlockSize =
iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
vecNetwBufferInProps[iIMAIdx].iAudioBlockSize =
iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
vecNetwBufferInProps[iMSIdx].iAudioBlockSize =
iCurNetBlockSizeFact * MIN_SERVER_BLOCK_SIZE_SAMPLES;
// None (no audio compression)
vecNetwBufferInProps[iNoneIdx].eAudComprType = CT_NONE;
@ -887,15 +892,24 @@ void CChannel::SetAudioCompressionOut ( const EAudComprType eNewAudComprTypeOut
}
}
void CChannel::SetSockBufSize ( const int iNumBlocks )
bool CChannel::SetSockBufSize ( const int iNumBlocks )
{
QMutexLocker locker ( &Mutex ); // this opperation must be done with mutex
iCurSockBufSize = iNumBlocks;
// first check for valid input parameter range
if ( ( iNumBlocks >= MIN_NET_BUF_SIZE_NUM_BL ) &&
( iNumBlocks <= MAX_NET_BUF_SIZE_NUM_BL ) )
{
iCurSockBufSize = iNumBlocks;
// the network block size is a multiple of the internal minimal
// block size
SockBuf.Init ( MIN_SERVER_BLOCK_SIZE_SAMPLES, iNumBlocks );
// the network block size is a multiple of the internal minimal
// block size
SockBuf.Init ( MIN_SERVER_BLOCK_SIZE_SAMPLES, iNumBlocks );
return false; // -> no error
}
return true; // set error flag
}
void CChannel::SetGain ( const int iChanID, const double dNewGain )

View file

@ -105,7 +105,7 @@ public:
void SetRemoteChanGain ( const int iId, const double dGain )
{ Protocol.CreateChanGainMes ( iId, dGain ); }
void SetSockBufSize ( const int iNumBlocks );
bool SetSockBufSize ( const int iNumBlocks );
int GetSockBufSize() { return iCurSockBufSize; }
void SetNetwBufSizeOut ( const int iNewAudioBlockSizeOut );

View file

@ -96,15 +96,13 @@ public:
bool GetDoAutoSockBufSize() { return bDoAutoSockBufSize; }
void SetSockBufSize ( const int iNumBlocks )
{
// only change parameter if new parameter is different from current one
if ( Channel.GetSockBufSize() != iNumBlocks )
{
// check for valid values
if ( ( iNumBlocks >= MIN_NET_BUF_SIZE_NUM_BL ) &&
( iNumBlocks <= MAX_NET_BUF_SIZE_NUM_BL ) )
// set the new socket size
if ( !Channel.SetSockBufSize ( iNumBlocks ) )
{
// set the new socket size
Channel.SetSockBufSize ( iNumBlocks );
// if setting of socket buffer size was successful,
// tell the server that size has changed
Channel.CreateJitBufMes ( iNumBlocks );
}

View file

@ -453,6 +453,7 @@ void CLlconClientDlg::customEvent ( QEvent* Event )
case MS_SET_JIT_BUF_SIZE:
pClient->SetSockBufSize ( iStatus );
break;
}
// update general settings dialog, too