From 1595a7446beb18b15ffbe897e50be22d486d2fd9 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 4 Mar 2006 16:49:11 +0000 Subject: [PATCH] bug fix --- src/protocol.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/protocol.cpp b/src/protocol.cpp index b5037800..594e7321 100755 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -156,8 +156,6 @@ for ( int i = 0; i < iNumBytes; i++ ) { } - - // important: vecbyDataConv must have iNumBytes to get it work!!! if ( ParseMessageFrame ( vecbyDataConv, iRecCounter, iRecID, vecData ) ) { @@ -248,18 +246,21 @@ void CProtocol::CreateJitBufMes ( const int iJitBufSize ) CVector vecData ( 2 ); // 2 bytes of data unsigned int iPos = 0; // init position pointer - // build data vector - PutValOnStream ( vecData, iPos, static_cast ( iJitBufSize ), 2 ); - - // build complete message - GenMessageFrame ( vecNewMessage, iCounter, PROTMESSID_JITT_BUF_SIZE, vecData ); + // store current counter value + const int iCurCounter = iCounter; // increase counter (wraps around automatically) // TODO: make it thread safe!!!!!!!!!!!! iCounter++; + // build data vector + PutValOnStream ( vecData, iPos, static_cast ( iJitBufSize ), 2 ); + + // build complete message + GenMessageFrame ( vecNewMessage, iCurCounter, PROTMESSID_JITT_BUF_SIZE, vecData ); + // enqueue message - EnqueueMessage ( vecNewMessage, iCounter, PROTMESSID_JITT_BUF_SIZE ); + EnqueueMessage ( vecNewMessage, iCurCounter, PROTMESSID_JITT_BUF_SIZE ); }