code cleanup

This commit is contained in:
Volker Fischer 2013-08-18 07:42:32 +00:00
parent 9d05436964
commit dcc4f0596f

View file

@ -100,23 +100,21 @@ public:
CHighPrioSocket ( CChannel* pNewChannel, CHighPrioSocket ( CChannel* pNewChannel,
const quint16 iPortNumber ) const quint16 iPortNumber )
{ {
// we have to register some classes to the Qt signal/slot mechanism
// TEST we have to register some classes to the Qt signal/slot mechanism // since we have thread crossings with the threaded code
// since now we actually have thread crossings with the new code
qRegisterMetaType<CVector<uint8_t> > ( "CVector<uint8_t>" ); qRegisterMetaType<CVector<uint8_t> > ( "CVector<uint8_t>" );
qRegisterMetaType<CHostAddress> ( "CHostAddress" ); qRegisterMetaType<CHostAddress> ( "CHostAddress" );
// Creation of the new socket thread which has to have the highest
// TEST actual creation of the new thread, see internet references below: // possible thread priority to make sure the jitter buffer is reliably
// http://qt-project.org/forums/viewthread/14393 // filled with the network audio packets and does not get interrupted
// http://qt-project.org/doc/qt-5.0/qtcore/qthread.html#Priority-enum // by other GUI threads. The following code is based on:
// http://qt-project.org/wiki/Threads_Events_QObjects // http://qt-project.org/wiki/Threads_Events_QObjects
pSocket = new CSocket ( pNewChannel, iPortNumber ); pSocket = new CSocket ( pNewChannel, iPortNumber );
pSocket->moveToThread ( &NetworkWorkerThread ); pSocket->moveToThread ( &NetworkWorkerThread );
NetworkWorkerThread.start ( QThread::TimeCriticalPriority ); NetworkWorkerThread.start ( QThread::TimeCriticalPriority );
// connect the "InvalidPacketReceived" signal
QObject::connect ( pSocket, QObject::connect ( pSocket,
SIGNAL ( InvalidPacketReceived ( CVector<uint8_t>, int, CHostAddress ) ), SIGNAL ( InvalidPacketReceived ( CVector<uint8_t>, int, CHostAddress ) ),
SIGNAL ( InvalidPacketReceived ( CVector<uint8_t>, int, CHostAddress ) ) ); SIGNAL ( InvalidPacketReceived ( CVector<uint8_t>, int, CHostAddress ) ) );