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