bug fix with mutexs
This commit is contained in:
parent
e15c2497e5
commit
ab19f4f2ae
1 changed files with 5 additions and 15 deletions
|
@ -226,21 +226,11 @@ CChannel::CChannel ()
|
||||||
void CChannel::SetSockBufSize ( const int iNewBlockSize, const int iNumBlocks )
|
void CChannel::SetSockBufSize ( const int iNewBlockSize, const int iNumBlocks )
|
||||||
{
|
{
|
||||||
/* this opperation must be done with mutex */
|
/* this opperation must be done with mutex */
|
||||||
|
|
||||||
qDebug ( "before lock" );
|
|
||||||
|
|
||||||
Mutex.lock ();
|
Mutex.lock ();
|
||||||
|
|
||||||
SockBuf.Init ( iNewBlockSize, iNumBlocks );
|
SockBuf.Init ( iNewBlockSize, iNumBlocks );
|
||||||
|
|
||||||
qDebug ( "in lock" );
|
|
||||||
|
|
||||||
|
|
||||||
Mutex.unlock ();
|
Mutex.unlock ();
|
||||||
|
|
||||||
|
|
||||||
qDebug ( "after lock" );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
|
void CChannel::OnJittBufSizeChange ( int iNewJitBufSize )
|
||||||
|
@ -267,8 +257,6 @@ bool CChannel::PutData ( const CVector<unsigned char>& vecbyData,
|
||||||
{
|
{
|
||||||
bool bRet = true;
|
bool bRet = true;
|
||||||
|
|
||||||
Mutex.lock (); /* put mutex lock */
|
|
||||||
|
|
||||||
/* only process if packet has correct size */
|
/* only process if packet has correct size */
|
||||||
if ( iNumBytes == iAudComprSize )
|
if ( iNumBytes == iAudComprSize )
|
||||||
{
|
{
|
||||||
|
@ -291,8 +279,12 @@ for (int i = 0; i < BLOCK_SIZE_SAMPLES; i++)
|
||||||
vecdResOutData[i] = (double) vecsDecomprAudio[i];
|
vecdResOutData[i] = (double) vecsDecomprAudio[i];
|
||||||
|
|
||||||
|
|
||||||
|
Mutex.lock (); /* put mutex lock */
|
||||||
|
|
||||||
bRet = SockBuf.Put ( vecdResOutData );
|
bRet = SockBuf.Put ( vecdResOutData );
|
||||||
|
|
||||||
|
Mutex.unlock (); /* put mutex unlock */
|
||||||
|
|
||||||
/* reset time-out counter */
|
/* reset time-out counter */
|
||||||
iConTimeOut = CON_TIME_OUT_CNT_MAX;
|
iConTimeOut = CON_TIME_OUT_CNT_MAX;
|
||||||
}
|
}
|
||||||
|
@ -305,8 +297,6 @@ for (int i = 0; i < BLOCK_SIZE_SAMPLES; i++)
|
||||||
bRet = Protocol.ParseMessage ( vecbyData, iNumBytes );
|
bRet = Protocol.ParseMessage ( vecbyData, iNumBytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex.unlock (); /* put mutex unlock */
|
|
||||||
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue