1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(coreav): fix static analysis warnings and code style

This commit is contained in:
Nils Fenner 2016-06-13 22:41:07 +02:00
parent 9f8ad3cf77
commit 31c154293b
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C

View File

@ -79,8 +79,6 @@ IndexedList<ToxFriendCall> CoreAV::calls;
*/ */
IndexedList<ToxGroupCall> CoreAV::groupCalls; IndexedList<ToxGroupCall> CoreAV::groupCalls;
using namespace std;
CoreAV::CoreAV(Tox *tox) CoreAV::CoreAV(Tox *tox)
: coreavThread{new QThread}, iterateTimer{new QTimer{this}}, : coreavThread{new QThread}, iterateTimer{new QTimer{this}},
threadSwitchLock{false} threadSwitchLock{false}
@ -188,7 +186,7 @@ bool CoreAV::answerCall(uint32_t friendNum)
bool ret; bool ret;
QMetaObject::invokeMethod(this, "answerCall", Qt::BlockingQueuedConnection, QMetaObject::invokeMethod(this, "answerCall", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum)); Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum));
threadSwitchLock.clear(std::memory_order_release); threadSwitchLock.clear(std::memory_order_release);
return ret; return ret;
@ -220,10 +218,12 @@ bool CoreAV::startCall(uint32_t friendNum, bool video)
qDebug() << "CoreAV::startCall: Backed off of thread-switch lock"; qDebug() << "CoreAV::startCall: Backed off of thread-switch lock";
return false; return false;
} }
bool ret;
(void)QMetaObject::invokeMethod(this, "startCall", Qt::BlockingQueuedConnection, bool ret;
Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum), Q_ARG(bool, video)); QMetaObject::invokeMethod(this, "startCall", Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, ret),
Q_ARG(uint32_t, friendNum),
Q_ARG(bool, video));
threadSwitchLock.clear(std::memory_order_release); threadSwitchLock.clear(std::memory_order_release);
return ret; return ret;
@ -256,8 +256,10 @@ bool CoreAV::cancelCall(uint32_t friendNum)
} }
bool ret; bool ret;
QMetaObject::invokeMethod(this, "cancelCall", Qt::BlockingQueuedConnection, QMetaObject::invokeMethod(this, "cancelCall",
Q_RETURN_ARG(bool, ret), Q_ARG(uint32_t, friendNum)); Qt::BlockingQueuedConnection,
Q_RETURN_ARG(bool, ret),
Q_ARG(uint32_t, friendNum));
threadSwitchLock.clear(std::memory_order_release); threadSwitchLock.clear(std::memory_order_release);
return ret; return ret;
@ -338,7 +340,7 @@ bool CoreAV::sendCallAudio(uint32_t callId, const int16_t *pcm, size_t samples,
return true; return true;
} }
void CoreAV::sendCallVideo(uint32_t callId, shared_ptr<VideoFrame> vframe) void CoreAV::sendCallVideo(uint32_t callId, std::shared_ptr<VideoFrame> vframe)
{ {
// We might be running in the FFmpeg thread and holding the CameraSource lock // We might be running in the FFmpeg thread and holding the CameraSource lock
// So be careful not to deadlock with anything while toxav locks in toxav_video_send_frame // So be careful not to deadlock with anything while toxav locks in toxav_video_send_frame